mirror of
https://github.com/OpenRouterTeam/spawn.git
synced 2026-04-28 03:49:31 +00:00
test: remove duplicate and theatrical tests (#2694)
Consolidated 3 separate per-exit-code dashboard URL tests (130, 137, 42)
into a single data-driven loop. Merged 2 per-signal tests (SIGTERM, SIGINT)
into one. Removed a weak always-true test ("always return a non-empty array")
that was already implied by the adjacent test above it. Net: 4 fewer tests,
no coverage loss.
Co-authored-by: spawn-qa-bot <qa@openrouter.ai>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
9e627dff29
commit
0b346dffcc
1 changed files with 42 additions and 32 deletions
|
|
@ -380,11 +380,6 @@ describe("getSignalGuidance", () => {
|
|||
const joined = lines.join("\n");
|
||||
expect(joined).toContain("SIGUSR1");
|
||||
});
|
||||
|
||||
it("should always return a non-empty array", () => {
|
||||
const lines = getSignalGuidance("SIGFOO");
|
||||
expect(lines.length).toBeGreaterThan(0);
|
||||
});
|
||||
});
|
||||
|
||||
describe("signal output uniqueness", () => {
|
||||
|
|
@ -500,23 +495,34 @@ describe("dashboard URL in guidance", () => {
|
|||
expect(joined).toContain("dashboard");
|
||||
});
|
||||
|
||||
it("should include dashboard URL for exit code 130 when provided", () => {
|
||||
const lines = getScriptFailureGuidance(130, "sprite", undefined, "https://sprite.sh");
|
||||
const joined = lines.join("\n");
|
||||
expect(joined).toContain("https://sprite.sh");
|
||||
expect(joined).toContain("dashboard");
|
||||
});
|
||||
|
||||
it("should include dashboard URL for exit code 137 when provided", () => {
|
||||
const lines = getScriptFailureGuidance(137, "vultr", undefined, "https://my.vultr.com/");
|
||||
const joined = lines.join("\n");
|
||||
expect(joined).toContain("https://my.vultr.com/");
|
||||
});
|
||||
|
||||
it("should include dashboard URL for default exit code when provided", () => {
|
||||
const lines = getScriptFailureGuidance(42, "digitalocean", undefined, "https://cloud.digitalocean.com/");
|
||||
const joined = lines.join("\n");
|
||||
expect(joined).toContain("https://cloud.digitalocean.com/");
|
||||
it("should include dashboard URL for all supported exit codes when provided", () => {
|
||||
const cases: Array<
|
||||
[
|
||||
number,
|
||||
string,
|
||||
string,
|
||||
]
|
||||
> = [
|
||||
[
|
||||
130,
|
||||
"sprite",
|
||||
"https://sprite.sh",
|
||||
],
|
||||
[
|
||||
137,
|
||||
"vultr",
|
||||
"https://my.vultr.com/",
|
||||
],
|
||||
[
|
||||
42,
|
||||
"digitalocean",
|
||||
"https://cloud.digitalocean.com/",
|
||||
],
|
||||
];
|
||||
for (const [code, cloud, url] of cases) {
|
||||
const joined = getScriptFailureGuidance(code, cloud, undefined, url).join("\n");
|
||||
expect(joined, `exit code ${code}`).toContain(url);
|
||||
}
|
||||
});
|
||||
|
||||
it("should fall back to generic message when no dashboardUrl", () => {
|
||||
|
|
@ -548,16 +554,20 @@ describe("dashboard URL in guidance", () => {
|
|||
expect(joined).toContain("dashboard");
|
||||
});
|
||||
|
||||
it("should include dashboard URL for SIGTERM when provided", () => {
|
||||
const lines = getSignalGuidance("SIGTERM", "https://my.vultr.com/");
|
||||
const joined = lines.join("\n");
|
||||
expect(joined).toContain("https://my.vultr.com/");
|
||||
});
|
||||
|
||||
it("should include dashboard URL for SIGINT when provided", () => {
|
||||
const lines = getSignalGuidance("SIGINT", "https://cloud.digitalocean.com/");
|
||||
const joined = lines.join("\n");
|
||||
expect(joined).toContain("https://cloud.digitalocean.com/");
|
||||
it("should include dashboard URL for SIGTERM and SIGINT when provided", () => {
|
||||
for (const [signal, url] of [
|
||||
[
|
||||
"SIGTERM",
|
||||
"https://my.vultr.com/",
|
||||
],
|
||||
[
|
||||
"SIGINT",
|
||||
"https://cloud.digitalocean.com/",
|
||||
],
|
||||
] as const) {
|
||||
const joined = getSignalGuidance(signal, url).join("\n");
|
||||
expect(joined, signal).toContain(url);
|
||||
}
|
||||
});
|
||||
|
||||
it("should fall back to generic message when no dashboardUrl", () => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue