* test(#1178): consolidate duplicated agent-roster helper into tests/helpers The "list gsd-*.md agent files, strip .md, sort" derivation was hand-duplicated across the suite (two listAgentFiles(), an identical agentFilesOnDisk(), and inline readdir blocks). Add tests/helpers/agent-roster.cjs exporting listAgentFiles(agentsDir?) and route the genuinely-identical source-roster sites through it. Semantically-different sites (installed-dest dirs, absolute-path returns, .toml-inclusive Codex rosters, full-.md-filename readers, the uniform multi-family inventory table) are left intact, each with a one-line comment. Test-only; no production code touched. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * test(#1178): note AGENTS_DIR export is for future call sites Review nit: clarify that the currently-unused AGENTS_DIR export is intentional — available for future tests needing the canonical source agents path. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Co-authored-by: Tom Boucher <trekkie@nomorestars.com>
This commit is contained in:
committed by
GitHub
parent
9d12725e4e
commit
fc5ca178a2
@@ -21,6 +21,7 @@ const {
|
||||
|
||||
const { resolveModelInternal } = require('../gsd-core/bin/lib/model-resolver.cjs');
|
||||
const { createTempProject, cleanup } = require('./helpers.cjs');
|
||||
const { listAgentFiles } = require('./helpers/agent-roster.cjs');
|
||||
|
||||
// ─── temp-project helpers ──────────────────────────────────────────────────────
|
||||
|
||||
@@ -32,18 +33,12 @@ function writeConfig(tmpDir, obj) {
|
||||
);
|
||||
}
|
||||
|
||||
function agentFilesOnDisk() {
|
||||
return fs.readdirSync(path.join(__dirname, '..', 'agents'))
|
||||
.filter((f) => /^gsd-.*\.md$/.test(f))
|
||||
.map((f) => f.replace(/\.md$/, ''))
|
||||
.sort();
|
||||
}
|
||||
|
||||
// ─── MODEL_PROFILES data integrity ────────────────────────────────────────────
|
||||
|
||||
describe('MODEL_PROFILES', () => {
|
||||
test('contains every shipped gsd agent file on disk (#3229)', () => {
|
||||
const expectedAgents = agentFilesOnDisk();
|
||||
// Canonical source roster (sorted gsd-* basenames without .md) — shared helper.
|
||||
const expectedAgents = listAgentFiles();
|
||||
const actualAgents = Object.keys(MODEL_PROFILES).sort();
|
||||
assert.deepStrictEqual(actualAgents, expectedAgents);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user