Total 1465 LOC + 616 test LOC, 78/78 tests pass. - @keisei/mcp-server (25 tests) — Rust-CLI bridge via execa, stdio+HTTP, HMAC auth, kei() meta-tool - @keisei/telegram-adapter (16 tests) — grammy Bot, 7 tools - @keisei/recall-adapter (8 tests) — Zoom via Recall.ai, 5 tools - @keisei/grok-adapter (6 tests) — xAI OpenAI-compatible, 2 tools - @keisei/gmail-adapter (11 tests) — googleapis OAuth2, 6 tools (new — LBM gap) - @keisei/youtube-adapter (12 tests) — YouTube Data API v3, 5 tools (new — LBM gap) RULE 0.2 exception #4 (TS for MCP/API layer documented in _ts_packages/README.md). RULE 0.8 — env vars only (TELEGRAM_BOT_TOKEN, XAI_API_KEY, GMAIL_*, YOUTUBE_API_KEY). Strict TypeScript: strict + exactOptionalPropertyTypes + noUncheckedIndexedAccess. Genesis-scan clean (0 hits).
40 lines
1.4 KiB
TypeScript
40 lines
1.4 KiB
TypeScript
import { describe, it, expect, vi } from "vitest";
|
|
import { RecallClient } from "../src/client.js";
|
|
|
|
function makeFetchMock(payload: unknown, ok = true, status = 200): typeof fetch {
|
|
return vi.fn(async () => {
|
|
return {
|
|
ok,
|
|
status,
|
|
async text() { return JSON.stringify(payload); },
|
|
async json() { return payload; },
|
|
} as unknown as Response;
|
|
}) as unknown as typeof fetch;
|
|
}
|
|
|
|
describe("RecallClient", () => {
|
|
it("rejects empty API key", () => {
|
|
expect(() => new RecallClient({ apiKey: "" })).toThrow(/RECALL_API_KEY/);
|
|
});
|
|
|
|
it("listBots calls GET /bot/", async () => {
|
|
const fetchImpl = makeFetchMock([{ id: "b1" }]);
|
|
const c = new RecallClient({ apiKey: "k", fetchImpl });
|
|
const out = (await c.listBots()) as Array<{ id: string }>;
|
|
expect(out[0]?.id).toBe("b1");
|
|
expect(fetchImpl).toHaveBeenCalledOnce();
|
|
});
|
|
|
|
it("joinMeeting POSTs meeting_url", async () => {
|
|
const fetchImpl = makeFetchMock({ id: "new" });
|
|
const c = new RecallClient({ apiKey: "k", fetchImpl });
|
|
const out = await c.joinMeeting("https://zoom.us/j/123");
|
|
expect((out as { id: string }).id).toBe("new");
|
|
});
|
|
|
|
it("propagates non-2xx responses as Error", async () => {
|
|
const fetchImpl = makeFetchMock({ detail: "forbidden" }, false, 403);
|
|
const c = new RecallClient({ apiKey: "k", fetchImpl });
|
|
await expect(c.getBot("b1")).rejects.toThrow(/403/);
|
|
});
|
|
});
|