Skip to main content
Glama
by thoughtspot
index.spec.ts1.34 kB
import { env, runInDurableObject, createExecutionContext, waitOnExecutionContext, } from "cloudflare:test"; import { describe, it, expect, vi } from "vitest"; // For now, you'll need to do something like this to get a correctly-typed // `Request` to pass to `worker.fetch()`. const IncomingRequest = Request<unknown, IncomingRequestCfProperties>; describe("The ThoughtSpot MCP Worker: Auth handler", () => { it("responds with Hello World! on '/hello'", async () => { // Clear module cache and import fresh vi.resetModules(); // Import the worker dynamically to get fresh instance const { default: worker, ThoughtSpotMCP } = await import("../src/index.js"); // Type assertion for worker to have fetch method const typedWorker = worker as { fetch: (request: Request, env: any, ctx: any) => Promise<Response> }; const request = new IncomingRequest("https://example.com/hello"); const ctx = createExecutionContext(); // Call the worker fetch directly without using Durable Object const result = await typedWorker.fetch(request, env, ctx); expect(result.status).toBe(200); expect(await result.json()).toMatchObject({ message: "Hello, World!", }); }); });

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/thoughtspot/mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server