Skip to main content
Glama
touchDesignerServer.test.ts1.7 kB
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js"; import { beforeEach, describe, expect, it, vi } from "vitest"; import { TouchDesignerServer } from "../../src/server/touchDesignerServer.js"; // 正しいパスでモックを設定 vi.mock("../../src/features/prompts/index.js", () => ({ registerPrompts: vi.fn(), })); vi.mock("../../src/features/resources/index.js", () => ({ registerResources: vi.fn(), })); vi.mock("../../src/features/tools/index.js", () => ({ registerTools: vi.fn(), })); vi.mock("@modelcontextprotocol/sdk/server/mcp.js", () => ({ McpServer: vi.fn(function MockMcpServer(this: Record<string, unknown>) { this.connect = vi.fn().mockResolvedValue(undefined); this.close = vi.fn().mockResolvedValue(undefined); this.tool = vi.fn(); this.server = { sendLoggingMessage: vi.fn(), setRequestHandler: vi.fn(), }; }), })); vi.mock("../../src/tdClient/index.js", () => ({ createTouchDesignerClient: vi.fn().mockReturnValue({ getTdInfo: vi .fn() .mockResolvedValue({ data: { server: "info" }, success: true }), }), })); describe("TouchDesignerServer", () => { beforeEach(() => { vi.clearAllMocks(); }); it("should initialize dependencies in the correct order", async () => { // テスト前にモジュールをインポート const promptsModule = await import("../../src/features/prompts/index.js"); const toolsModule = await import("../../src/features/tools/index.js"); new TouchDesignerServer(); expect(McpServer).toHaveBeenCalledTimes(1); // モック関数が呼ばれたか確認 expect(promptsModule.registerPrompts).toHaveBeenCalled(); expect(toolsModule.registerTools).toHaveBeenCalled(); }); });

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/8beeeaaat/touchdesigner-mcp'

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