import { readFileSync, existsSync } from "node:fs"; import { resolve } from "node:path"; import { execSync } from "node:child_process"; import { describe, it, expect } from "vitest"; const REPO_ROOT = execSync("git rev-parse --show-toplevel", { encoding: "utf-8" }).trim(); const DOCS_ROOT = resolve(REPO_ROOT, "docs/integrations"); const INTEGRATION_DOCS = [ { file: "cursor.md", rootKey: "mcpServers", configPath: ".cursor/mcp.json", }, { file: "vscode.md", rootKey: "servers", // VS Code uses different root key! configPath: ".vscode/mcp.json", }, { file: "windsurf.md", rootKey: "mcpServers", configPath: "~/.codeium/windsurf/mcp_config.json", }, { file: "cline.md", rootKey: "mcpServers", configPath: "cline_mcp_settings.json", }, ]; for (const doc of INTEGRATION_DOCS) { describe(`${doc.file}`, () => { const filePath = resolve(DOCS_ROOT, doc.file); it("exists", () => { expect(existsSync(filePath)).toBe(true); }); it("has 3-section structure (Prerequisites, Configuration, Verify)", () => { const content = readFileSync(filePath, "utf-8"); expect(content).toContain("## Prerequisites"); expect(content).toContain("## Configuration"); expect(content).toContain("## Verify It Works"); }); it(`uses correct root key "${doc.rootKey}"`, () => { const content = readFileSync(filePath, "utf-8"); expect(content).toContain(`"${doc.rootKey}"`); }); it("references fathom-token-mcp", () => { const content = readFileSync(filePath, "utf-8"); expect(content).toContain("fathom-token-mcp@latest"); }); it("contains copy-pasteable JSON config block", () => { const content = readFileSync(filePath, "utf-8"); expect(content).toContain("```json"); expect(content).toContain('"fathom"'); }); it(`mentions config file path ${doc.configPath}`, () => { const content = readFileSync(filePath, "utf-8"); expect(content).toContain(doc.configPath); }); }); }