test: Remove duplicate and theatrical tests (#2054)

* test: Remove duplicate and theatrical tests

- check-entity.test.ts: Remove 'kind parameter consistency' describe block
  (9 tests) that fully duplicated coverage already provided by 'valid entities',
  'wrong-type detection: cloud given as agent', and 'wrong-type detection: agent
  given as cloud' describes. Also remove redundant loop assertions ('should
  return true for all three agent keys' etc.) that repeated what the individual
  named tests already covered.
- manifest-cache-lifecycle.test.ts: Replace Record<string, any> with
  Record<string, AgentDef> and Record<string, CloudDef> for type safety.

1401 tests pass, 0 fail. Lint clean.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix: remove extra blank line to pass Biome format check

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

* test: Remove duplicate and theatrical tests

Remove redundant if-guards around always-present agent metadata fields in
manifest-type-contracts.test.ts. All 12 metadata fields (creator, repo,
license, created, added, github_stars, stars_updated, language, runtime,
category, tagline, tags) are present on all 7 agents, making the
if (agent.X !== undefined) guards always-truthy dead code that misleads
readers into thinking tests might be skipped. Restructure into proper
per-agent describe blocks to make the test structure honest and clear.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix: Apply Biome formatting to array literal

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

* test: Remove duplicate and theatrical tests

Fix always-pass anti-pattern in manifest-type-contracts.test.ts where
optional field type tests were gated by `if (field !== undefined)` OUTSIDE
the `it()` block. When no agent/cloud had the field, zero tests registered,
giving false confidence.

Changes:
- Agent optional field types: move condition inside `it()`, test always runs
- Cloud optional field types: same fix, tests always register for all clouds
- Interactive prompts structure: consolidate filtered loop into one `it()` that
  iterates internally, avoiding silently-absent test registrations
- Config files structure: same consolidation pattern

Before: 551 pass, 64 fail (optional field tests only registered per-agent)
After:  566 pass, 64 fail (optional field tests register for every agent/cloud)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* style: fix biome lint errors - add block statements to early returns

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

* style: apply biome formatter to block statements

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

---------

Co-authored-by: spawn-qa-bot <qa@openrouter.ai>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: L <6723574+louisgv@users.noreply.github.com>
This commit is contained in:
A 2026-03-01 01:16:05 -08:00 committed by GitHub
parent 210519a590
commit 41adfbdb0a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -103,29 +103,32 @@ describe("Agent OPENROUTER_API_KEY requirement", () => {
describe("Agent optional field types (when present)", () => {
for (const [key, agent] of allAgents) {
if (agent.pre_launch !== undefined) {
it(`agent "${key}" pre_launch should be a string`, () => {
expect(typeof agent.pre_launch).toBe("string");
});
}
it(`agent "${key}" pre_launch should be a string when present`, () => {
if (agent.pre_launch === undefined) {
return;
}
expect(typeof agent.pre_launch).toBe("string");
});
if (agent.config_files !== undefined) {
it(`agent "${key}" config_files should be an object with string keys`, () => {
expect(typeof agent.config_files).toBe("object");
expect(agent.config_files).not.toBeNull();
for (const filePath of Object.keys(agent.config_files!)) {
expect(typeof filePath).toBe("string");
expect(filePath.length).toBeGreaterThan(0);
}
});
}
it(`agent "${key}" config_files should be an object with string keys when present`, () => {
if (agent.config_files === undefined) {
return;
}
expect(typeof agent.config_files).toBe("object");
expect(agent.config_files).not.toBeNull();
for (const filePath of Object.keys(agent.config_files)) {
expect(typeof filePath).toBe("string");
expect(filePath.length).toBeGreaterThan(0);
}
});
if (agent.notes !== undefined) {
it(`agent "${key}" notes should be a non-empty string`, () => {
expect(typeof agent.notes).toBe("string");
expect(agent.notes!.length).toBeGreaterThan(0);
});
}
it(`agent "${key}" notes should be a non-empty string when present`, () => {
if (agent.notes === undefined) {
return;
}
expect(typeof agent.notes).toBe("string");
expect(agent.notes.length).toBeGreaterThan(0);
});
}
});
@ -182,27 +185,30 @@ describe("Cloud required field types", () => {
describe("Cloud optional field types (when present)", () => {
for (const [key, cloud] of allClouds) {
if (cloud.defaults !== undefined) {
it(`cloud "${key}" defaults should be an object`, () => {
expect(typeof cloud.defaults).toBe("object");
expect(cloud.defaults).not.toBeNull();
expect(Array.isArray(cloud.defaults)).toBe(false);
});
}
it(`cloud "${key}" defaults should be an object when present`, () => {
if (cloud.defaults === undefined) {
return;
}
expect(typeof cloud.defaults).toBe("object");
expect(cloud.defaults).not.toBeNull();
expect(Array.isArray(cloud.defaults)).toBe(false);
});
if (cloud.notes !== undefined) {
it(`cloud "${key}" notes should be a non-empty string`, () => {
expect(typeof cloud.notes).toBe("string");
expect(cloud.notes!.length).toBeGreaterThan(0);
});
}
it(`cloud "${key}" notes should be a non-empty string when present`, () => {
if (cloud.notes === undefined) {
return;
}
expect(typeof cloud.notes).toBe("string");
expect(cloud.notes.length).toBeGreaterThan(0);
});
if (cloud.icon !== undefined) {
it(`cloud "${key}" icon should be a valid URL string`, () => {
expect(typeof cloud.icon).toBe("string");
expect(cloud.icon).toMatch(/^https?:\/\//);
});
}
it(`cloud "${key}" icon should be a valid URL string when present`, () => {
if (cloud.icon === undefined) {
return;
}
expect(typeof cloud.icon).toBe("string");
expect(cloud.icon).toMatch(/^https?:\/\//);
});
}
});
@ -283,18 +289,18 @@ describe("Agent launch command consistency", () => {
// ── Interactive prompts structure ─────────────────────────────────────────
describe("Interactive prompts structure", () => {
for (const [key, agent] of allAgents.filter(([, a]) => a.interactive_prompts !== undefined)) {
for (const [promptKey, entry] of Object.entries(agent.interactive_prompts!)) {
it(`agent "${key}" prompt "${promptKey}" should have non-empty prompt text`, () => {
it("all interactive_prompts entries should have non-empty prompt text and string defaults", () => {
for (const [key, agent] of allAgents) {
if (agent.interactive_prompts === undefined) {
continue;
}
for (const [promptKey, entry] of Object.entries(agent.interactive_prompts)) {
expect(entry.prompt.trim().length).toBeGreaterThan(0);
});
it(`agent "${key}" prompt "${promptKey}" default should be defined`, () => {
expect(entry.default).toBeDefined();
expect(typeof entry.default).toBe("string");
});
}
}
}
});
});
// ── Agent metadata field types ────────────────────────────────────────
@ -377,19 +383,17 @@ describe("Agent metadata field types", () => {
// ── Config files structure ────────────────────────────────────────────────
describe("Config files structure", () => {
for (const [key, agent] of allAgents.filter(([, a]) => a.config_files !== undefined)) {
it(`agent "${key}" config file paths should look like file paths`, () => {
for (const filePath of Object.keys(agent.config_files!)) {
it("config file paths should look like file paths and values should be objects", () => {
for (const [key, agent] of allAgents) {
if (agent.config_files === undefined) {
continue;
}
for (const [filePath, content] of Object.entries(agent.config_files)) {
// Should contain / or ~ or . indicating a path
expect(filePath).toMatch(/[/~.]/);
}
});
it(`agent "${key}" config file values should be objects`, () => {
for (const [path, content] of Object.entries(agent.config_files!)) {
expect(typeof content).toBe("object");
expect(content).not.toBeNull();
}
});
}
}
});
});