From be1c04ee0afd3fdd1f535dbf03e165eecf4736ef Mon Sep 17 00:00:00 2001 From: protosphinx <133899485+protosphinx@users.noreply.github.com> Date: Sun, 3 May 2026 16:14:31 +0000 Subject: [PATCH] test(checks): cover three untested edge cases in runChecks Add tests for: - empty mcpServers set: mcp-server-unknown is skipped when no settings.json is present (the config.mcpServers.size > 0 guard) - description-collision negative path: Jaccard below 0.6 does not fire the collision diagnostic - name-drift directory match: name matching dirBase passes the check even when the filename differs --- test/checks.test.ts | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/test/checks.test.ts b/test/checks.test.ts index b8172ea..ccb0968 100644 --- a/test/checks.test.ts +++ b/test/checks.test.ts @@ -130,4 +130,41 @@ describe("runChecks", () => { const ds = runChecks([s], config); expect(ds.some((d) => d.rule === "description-length")).toBe(true); }); + + it("skips mcp-server-unknown when mcpServers set is empty", () => { + const noServersConfig: SkillcheckConfig = { + knownTools: new Set(BUILTIN_TOOLS), + mcpServers: new Set(), + cwd: "/test", + }; + const s = mkSkill("/test/foo/foo.md", { + name: "foo", + description: "do foo", + tools: ["mcp__anyserver__some_tool"], + }); + const ds = runChecks([s], noServersConfig); + expect(ds.find((d) => d.rule === "mcp-server-unknown")).toBeUndefined(); + }); + + it("does not fire description-collision when Jaccard is below threshold", () => { + const a = mkSkill("/test/a/a.md", { + name: "a", + description: "deploy the application to staging environment", + }); + const b = mkSkill("/test/b/b.md", { + name: "b", + description: "search repositories and list open pull requests", + }); + const ds = runChecks([a, b], config); + expect(ds.filter((d) => d.rule === "description-collision").length).toBe(0); + }); + + it("does not flag name-drift when name matches the directory", () => { + const s = mkSkill("/test/foo/index.md", { + name: "foo", + description: "do the foo thing", + }); + const ds = runChecks([s], config); + expect(ds.find((d) => d.rule === "name-drift")).toBeUndefined(); + }); });