Skip to main content
Glama
analyze-risk-http.e2e.test.tsβ€’1.67 kB
import { SnapBackEventBus } from "@snapback/events"; import { ExtensionClient } from "@snapback/sdk"; import { afterAll, beforeAll, describe, it } from "vitest"; import { MCPHttpServer } from "../../src/http-server.js"; // Mock the event bus and extension client to prevent connection errors vi.mock("@snapback/events"); vi.mock("@snapback/sdk"); describe("Analyze Risk HTTP E2E Tests", () => { let httpServer: MCPHttpServer; let testPort: number; let _serverUrl: string; beforeAll(async () => { // Mock the event bus and extension client to prevent connection errors vi.mocked(SnapBackEventBus).mockImplementation(() => ({ connect: vi.fn().mockResolvedValue(undefined), close: vi.fn(), publishTelemetryEvent: vi.fn(), publishAnalysisResult: vi.fn(), })); vi.mocked(ExtensionClient).mockImplementation(() => ({ initialize: vi.fn().mockResolvedValue(undefined), sendRequest: vi.fn().mockResolvedValue({}), dispose: vi.fn(), })); // Find an available port testPort = 3000 + Math.floor(Math.random() * 1000); _serverUrl = `http://localhost:${testPort}`; // Start the HTTP server httpServer = new MCPHttpServer(testPort); await httpServer.start(); }); afterAll(async () => { // Stop the HTTP server await httpServer.stop(); }); it.skip("should analyze risk via HTTP POST request", async () => { // TODO: Implement real HTTP POST test // 1. Send a POST request to the analyze-risk endpoint with test data // 2. Verify the response contains the expected analysis results // 3. Check that the server properly handles errors gracefully // This test will be implemented when E2E test harness is ready }); });

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/snapback-dev/mcp-server'

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