mirror of
https://github.com/OpenRouterTeam/spawn.git
synced 2026-05-18 23:51:40 +00:00
test: consolidate duplicate agent envVars tests into data-driven table (#3064)
Five separate it() blocks each checking one agent's env vars (openclaw, zeroclaw, hermes, kilocode, opencode) were collapsed into a single data-driven table test. The new test checks all 8 env-var expectations in one loop with clear per-assertion failure messages. Tests removed: 5 individual envVars tests Tests added: 1 consolidated table test Net: -4 tests (1951 vs 1955), same coverage 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
f9b81475fe
commit
d666ab173c
1 changed files with 52 additions and 28 deletions
|
|
@ -148,12 +148,6 @@ describe("createCloudAgents", () => {
|
|||
expect(runner.uploadFile).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("openclaw agent envVars include OPENROUTER_API_KEY", () => {
|
||||
const envVars = result.agents.openclaw.envVars("sk-or-v1-test");
|
||||
expect(envVars.some((v: string) => v.includes("OPENROUTER_API_KEY"))).toBe(true);
|
||||
expect(envVars.some((v: string) => v.includes("ANTHROPIC_BASE_URL"))).toBe(true);
|
||||
});
|
||||
|
||||
it("openclaw agent has tunnel config", () => {
|
||||
const openclaw = result.agents.openclaw;
|
||||
expect(openclaw.tunnel).toBeDefined();
|
||||
|
|
@ -162,22 +156,6 @@ describe("createCloudAgents", () => {
|
|||
expect(url).toContain("localhost:8080");
|
||||
});
|
||||
|
||||
it("zeroclaw agent envVars include ZEROCLAW_PROVIDER", () => {
|
||||
const envVars = result.agents.zeroclaw.envVars("sk-or-v1-test");
|
||||
expect(envVars.some((v: string) => v.includes("ZEROCLAW_PROVIDER=openrouter"))).toBe(true);
|
||||
});
|
||||
|
||||
it("zeroclaw agent configure calls runServer", async () => {
|
||||
await result.agents.zeroclaw.configure?.("sk-or-v1-test", undefined, new Set());
|
||||
expect(runner.runServer).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("hermes agent envVars include OPENAI_BASE_URL", () => {
|
||||
const envVars = result.agents.hermes.envVars("sk-or-v1-test");
|
||||
expect(envVars.some((v: string) => v.includes("OPENAI_BASE_URL"))).toBe(true);
|
||||
expect(envVars.some((v: string) => v.includes("HERMES_YOLO_MODE"))).toBe(true);
|
||||
});
|
||||
|
||||
it("hermes agent configure removes YOLO mode when not enabled", async () => {
|
||||
// Pass empty set (yolo-mode not in enabled steps)
|
||||
await result.agents.hermes.configure?.("sk-test", undefined, new Set());
|
||||
|
|
@ -199,14 +177,60 @@ describe("createCloudAgents", () => {
|
|||
expect(runner.runServer).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("kilocode agent envVars include KILO_PROVIDER_TYPE", () => {
|
||||
const envVars = result.agents.kilocode.envVars("sk-or-v1-test");
|
||||
expect(envVars.some((v: string) => v.includes("KILO_PROVIDER_TYPE=openrouter"))).toBe(true);
|
||||
it("agent envVars include provider-specific env vars", () => {
|
||||
const cases: Array<
|
||||
[
|
||||
string,
|
||||
string[],
|
||||
]
|
||||
> = [
|
||||
[
|
||||
"openclaw",
|
||||
[
|
||||
"OPENROUTER_API_KEY",
|
||||
"ANTHROPIC_BASE_URL",
|
||||
],
|
||||
],
|
||||
[
|
||||
"zeroclaw",
|
||||
[
|
||||
"ZEROCLAW_PROVIDER=openrouter",
|
||||
],
|
||||
],
|
||||
[
|
||||
"hermes",
|
||||
[
|
||||
"OPENAI_BASE_URL",
|
||||
"HERMES_YOLO_MODE",
|
||||
],
|
||||
],
|
||||
[
|
||||
"kilocode",
|
||||
[
|
||||
"KILO_PROVIDER_TYPE=openrouter",
|
||||
],
|
||||
],
|
||||
[
|
||||
"opencode",
|
||||
[
|
||||
"OPENROUTER_API_KEY",
|
||||
],
|
||||
],
|
||||
];
|
||||
for (const [agent, expectedVars] of cases) {
|
||||
const envVars = result.agents[agent].envVars("sk-or-v1-test");
|
||||
for (const expected of expectedVars) {
|
||||
expect(
|
||||
envVars.some((v: string) => v.includes(expected)),
|
||||
`${agent} envVars should include ${expected}`,
|
||||
).toBe(true);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
it("opencode agent envVars include OPENROUTER_API_KEY", () => {
|
||||
const envVars = result.agents.opencode.envVars("sk-or-v1-test");
|
||||
expect(envVars.some((v: string) => v.includes("OPENROUTER_API_KEY"))).toBe(true);
|
||||
it("zeroclaw agent configure calls runServer", async () => {
|
||||
await result.agents.zeroclaw.configure?.("sk-or-v1-test", undefined, new Set());
|
||||
expect(runner.runServer).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("all agents have launchCmd returning non-empty string", () => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue