Skip to content

Commit e29bb3a

Browse files
committed
test: add agents list consistency check between index.ts and files
Signed-off-by: leocavalcante <leo@cavalcante.dev>
1 parent 5a19e49 commit e29bb3a

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

tests/index.test.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
import { describe, expect, it } from "bun:test"
2+
import { readdirSync } from "node:fs"
3+
import { join } from "node:path"
24
import pkg from "../package.json"
35
import { agents, description, name, version } from "../src/index.ts"
46

@@ -25,4 +27,14 @@ describe("index.ts exports", () => {
2527
it("should have 3 agents", () => {
2628
expect(agents).toHaveLength(3)
2729
})
30+
31+
it("should have matching agent files in agents/ directory", () => {
32+
const agentsDir = join(import.meta.dirname, "..", "agents")
33+
const files = readdirSync(agentsDir)
34+
const mdFiles = files.filter((f) => f.endsWith(".md"))
35+
const agentNamesFromFiles = mdFiles.map((f) => f.replace(/\.md$/, "")).sort()
36+
const agentNamesFromExport = [...agents].sort()
37+
38+
expect(agentNamesFromExport).toEqual(agentNamesFromFiles)
39+
})
2840
})

0 commit comments

Comments
 (0)