mirror of
https://github.com/OpenRouterTeam/spawn.git
synced 2026-05-19 16:39:50 +00:00
test: Remove duplicate and theatrical tests (#2047)
* 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>
---------
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:
parent
2155a36a1f
commit
e1ef024981
3 changed files with 19 additions and 92 deletions
|
|
@ -135,12 +135,6 @@ describe("checkEntity", () => {
|
|||
it("should return true for cloud key 'vultr'", () => {
|
||||
expect(checkEntity(manifest, "vultr", "cloud")).toBe(true);
|
||||
});
|
||||
|
||||
it("should return true for all three agent keys", () => {
|
||||
for (const key of Object.keys(manifest.agents)) {
|
||||
expect(checkEntity(manifest, key, "agent")).toBe(true);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// ── Wrong-type detection: cloud given as agent ──────────────────────────
|
||||
|
|
@ -157,12 +151,6 @@ describe("checkEntity", () => {
|
|||
it("should return false when 'vultr' is checked as agent", () => {
|
||||
expect(checkEntity(manifest, "vultr", "agent")).toBe(false);
|
||||
});
|
||||
|
||||
it("should return false for all three cloud keys when checked as agent", () => {
|
||||
for (const key of Object.keys(manifest.clouds)) {
|
||||
expect(checkEntity(manifest, key, "agent")).toBe(false);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// ── Wrong-type detection: agent given as cloud ──────────────────────────
|
||||
|
|
@ -179,12 +167,6 @@ describe("checkEntity", () => {
|
|||
it("should return false when 'cline' is checked as cloud", () => {
|
||||
expect(checkEntity(manifest, "cline", "cloud")).toBe(false);
|
||||
});
|
||||
|
||||
it("should return false for all three agent keys when checked as cloud", () => {
|
||||
for (const key of Object.keys(manifest.agents)) {
|
||||
expect(checkEntity(manifest, key, "cloud")).toBe(false);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// ── Non-existent entities: no close match (distance > 3) ───────────────
|
||||
|
|
@ -360,40 +342,6 @@ describe("checkEntity", () => {
|
|||
});
|
||||
});
|
||||
|
||||
// ── Kind parameter consistency ──────────────────────────────────────────
|
||||
|
||||
describe("kind parameter consistency", () => {
|
||||
it("should accept claude as agent but reject as cloud", () => {
|
||||
expect(checkEntity(manifest, "claude", "agent")).toBe(true);
|
||||
expect(checkEntity(manifest, "claude", "cloud")).toBe(false);
|
||||
});
|
||||
|
||||
it("should accept codex as agent but reject as cloud", () => {
|
||||
expect(checkEntity(manifest, "codex", "agent")).toBe(true);
|
||||
expect(checkEntity(manifest, "codex", "cloud")).toBe(false);
|
||||
});
|
||||
|
||||
it("should accept sprite as cloud but reject as agent", () => {
|
||||
expect(checkEntity(manifest, "sprite", "cloud")).toBe(true);
|
||||
expect(checkEntity(manifest, "sprite", "agent")).toBe(false);
|
||||
});
|
||||
|
||||
it("should accept hetzner as cloud but reject as agent", () => {
|
||||
expect(checkEntity(manifest, "hetzner", "cloud")).toBe(true);
|
||||
expect(checkEntity(manifest, "hetzner", "agent")).toBe(false);
|
||||
});
|
||||
|
||||
it("should accept vultr as cloud but reject as agent", () => {
|
||||
expect(checkEntity(manifest, "vultr", "cloud")).toBe(true);
|
||||
expect(checkEntity(manifest, "vultr", "agent")).toBe(false);
|
||||
});
|
||||
|
||||
it("should accept cline as agent but reject as cloud", () => {
|
||||
expect(checkEntity(manifest, "cline", "agent")).toBe(true);
|
||||
expect(checkEntity(manifest, "cline", "cloud")).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
// ── All agents are valid when checked as agents ────────────────────────
|
||||
|
||||
describe("all manifest agents validate correctly", () => {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { describe, it, expect, beforeEach, afterEach, mock } from "bun:test";
|
||||
import { existsSync, writeFileSync, mkdirSync, rmSync, utimesSync } from "node:fs";
|
||||
import { join } from "node:path";
|
||||
import type { Manifest } from "../manifest";
|
||||
import type { Manifest, AgentDef, CloudDef } from "../manifest";
|
||||
import { loadManifest, agentKeys, cloudKeys, matrixStatus, countImplemented, isValidManifest } from "../manifest";
|
||||
import type { TestEnvironment } from "./test-helpers";
|
||||
import { createMockManifest, setupTestEnvironment, teardownTestEnvironment } from "./test-helpers";
|
||||
|
|
@ -668,7 +668,7 @@ describe("Manifest Cache Lifecycle", () => {
|
|||
});
|
||||
|
||||
it("should handle manifest with many agents", () => {
|
||||
const agents: Record<string, any> = {};
|
||||
const agents: Record<string, AgentDef> = {};
|
||||
for (let i = 0; i < 50; i++) {
|
||||
agents[`agent-${i}`] = mockManifest.agents.claude;
|
||||
}
|
||||
|
|
@ -683,7 +683,7 @@ describe("Manifest Cache Lifecycle", () => {
|
|||
});
|
||||
|
||||
it("should handle manifest with many clouds", () => {
|
||||
const clouds: Record<string, any> = {};
|
||||
const clouds: Record<string, CloudDef> = {};
|
||||
for (let i = 0; i < 30; i++) {
|
||||
clouds[`cloud-${i}`] = mockManifest.clouds.sprite;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -299,74 +299,57 @@ describe("Interactive prompts structure", () => {
|
|||
|
||||
// ── Agent metadata field types ────────────────────────────────────────
|
||||
|
||||
describe("Agent metadata field types (when present)", () => {
|
||||
// These fields are present on all current agents — no conditional guards needed.
|
||||
describe("Agent metadata field types", () => {
|
||||
for (const [key, agent] of allAgents) {
|
||||
if (agent.creator !== undefined) {
|
||||
it(`agent "${key}" creator should be a non-empty string`, () => {
|
||||
describe(`agent "${key}"`, () => {
|
||||
it("creator should be a non-empty string", () => {
|
||||
expect(typeof agent.creator).toBe("string");
|
||||
expect(agent.creator!.length).toBeGreaterThan(0);
|
||||
});
|
||||
}
|
||||
|
||||
if (agent.repo !== undefined) {
|
||||
it(`agent "${key}" repo should match owner/repo format`, () => {
|
||||
it("repo should match owner/repo format", () => {
|
||||
expect(typeof agent.repo).toBe("string");
|
||||
expect(agent.repo).toMatch(/^[A-Za-z0-9._-]+\/[A-Za-z0-9._-]+$/);
|
||||
});
|
||||
}
|
||||
|
||||
if (agent.license !== undefined) {
|
||||
it(`agent "${key}" license should be a non-empty string`, () => {
|
||||
it("license should be a non-empty string", () => {
|
||||
expect(typeof agent.license).toBe("string");
|
||||
expect(agent.license!.length).toBeGreaterThan(0);
|
||||
});
|
||||
}
|
||||
|
||||
if (agent.created !== undefined) {
|
||||
it(`agent "${key}" created should be YYYY-MM format`, () => {
|
||||
it("created should be YYYY-MM format", () => {
|
||||
expect(typeof agent.created).toBe("string");
|
||||
expect(agent.created).toMatch(/^\d{4}-\d{2}$/);
|
||||
});
|
||||
}
|
||||
|
||||
if (agent.added !== undefined) {
|
||||
it(`agent "${key}" added should be YYYY-MM format`, () => {
|
||||
it("added should be YYYY-MM format", () => {
|
||||
expect(typeof agent.added).toBe("string");
|
||||
expect(agent.added).toMatch(/^\d{4}-\d{2}$/);
|
||||
});
|
||||
}
|
||||
|
||||
if (agent.github_stars !== undefined) {
|
||||
it(`agent "${key}" github_stars should be a non-negative number`, () => {
|
||||
it("github_stars should be a non-negative integer", () => {
|
||||
expect(typeof agent.github_stars).toBe("number");
|
||||
expect(agent.github_stars!).toBeGreaterThanOrEqual(0);
|
||||
expect(Number.isInteger(agent.github_stars)).toBe(true);
|
||||
});
|
||||
}
|
||||
|
||||
if (agent.stars_updated !== undefined) {
|
||||
it(`agent "${key}" stars_updated should be YYYY-MM-DD format`, () => {
|
||||
it("stars_updated should be YYYY-MM-DD format", () => {
|
||||
expect(typeof agent.stars_updated).toBe("string");
|
||||
expect(agent.stars_updated).toMatch(/^\d{4}-\d{2}-\d{2}$/);
|
||||
});
|
||||
}
|
||||
|
||||
if (agent.language !== undefined) {
|
||||
it(`agent "${key}" language should be a non-empty string`, () => {
|
||||
it("language should be a non-empty string", () => {
|
||||
expect(typeof agent.language).toBe("string");
|
||||
expect(agent.language!.length).toBeGreaterThan(0);
|
||||
});
|
||||
}
|
||||
|
||||
if (agent.runtime !== undefined) {
|
||||
it(`agent "${key}" runtime should be a non-empty string`, () => {
|
||||
it("runtime should be a non-empty string", () => {
|
||||
expect(typeof agent.runtime).toBe("string");
|
||||
expect(agent.runtime!.length).toBeGreaterThan(0);
|
||||
});
|
||||
}
|
||||
|
||||
if (agent.category !== undefined) {
|
||||
it(`agent "${key}" category should be cli, tui, or ide-extension`, () => {
|
||||
it("category should be cli, tui, or ide-extension", () => {
|
||||
expect(typeof agent.category).toBe("string");
|
||||
expect([
|
||||
"cli",
|
||||
|
|
@ -374,24 +357,20 @@ describe("Agent metadata field types (when present)", () => {
|
|||
"ide-extension",
|
||||
]).toContain(agent.category);
|
||||
});
|
||||
}
|
||||
|
||||
if (agent.tagline !== undefined) {
|
||||
it(`agent "${key}" tagline should be a non-empty string`, () => {
|
||||
it("tagline should be a non-empty string", () => {
|
||||
expect(typeof agent.tagline).toBe("string");
|
||||
expect(agent.tagline!.length).toBeGreaterThan(0);
|
||||
});
|
||||
}
|
||||
|
||||
if (agent.tags !== undefined) {
|
||||
it(`agent "${key}" tags should be an array of non-empty strings`, () => {
|
||||
it("tags should be an array of non-empty strings", () => {
|
||||
expect(Array.isArray(agent.tags)).toBe(true);
|
||||
for (const tag of agent.tags!) {
|
||||
expect(typeof tag).toBe("string");
|
||||
expect(tag.length).toBeGreaterThan(0);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue