diff --git a/packages/cli/src/__tests__/check-entity.test.ts b/packages/cli/src/__tests__/check-entity.test.ts index a5fffaa9..3a54b34e 100644 --- a/packages/cli/src/__tests__/check-entity.test.ts +++ b/packages/cli/src/__tests__/check-entity.test.ts @@ -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", () => { diff --git a/packages/cli/src/__tests__/manifest-cache-lifecycle.test.ts b/packages/cli/src/__tests__/manifest-cache-lifecycle.test.ts index df577b46..7bf65ded 100644 --- a/packages/cli/src/__tests__/manifest-cache-lifecycle.test.ts +++ b/packages/cli/src/__tests__/manifest-cache-lifecycle.test.ts @@ -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 = {}; + const agents: Record = {}; 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 = {}; + const clouds: Record = {}; for (let i = 0; i < 30; i++) { clouds[`cloud-${i}`] = mockManifest.clouds.sprite; } diff --git a/packages/cli/src/__tests__/manifest-type-contracts.test.ts b/packages/cli/src/__tests__/manifest-type-contracts.test.ts index 406a5538..1d79194e 100644 --- a/packages/cli/src/__tests__/manifest-type-contracts.test.ts +++ b/packages/cli/src/__tests__/manifest-type-contracts.test.ts @@ -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); } }); - } + }); } });