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:
A 2026-03-16 14:17:27 -07:00 committed by GitHub
parent 9e627dff29
commit 0b346dffcc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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", () => {