test: remove duplicate and theatrical tests (#2853)

- Remove `digitalocean/findSpawnSnapshot` describe from do-cov.test.ts
  (3 basic tests) — fully superseded by do-snapshot.test.ts (7 thorough
  tests covering name filtering, invalid IDs, network failure, etc.)

- Remove `setupAutoUpdate` describe from agent-setup-cov.test.ts
  (2 shallow tests checking only "systemd" string presence) — fully
  superseded by auto-update.test.ts which verifies exact systemd unit
  content, base64-encoded scripts, timer schedules, and error handling

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-20 22:24:00 -07:00 committed by GitHub
parent 26332afa56
commit a3e0dbd4dd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 3 additions and 88 deletions

View file

@ -2,8 +2,9 @@
* agent-setup-cov.test.ts Coverage tests for shared/agent-setup.ts
*
* Covers: createCloudAgents, offerGithubAuth, installAgent,
* uploadConfigFile, validateRemotePath, setupAutoUpdate
* uploadConfigFile, validateRemotePath
* (wrapSshCall is covered in with-retry-result.test.ts)
* (setupAutoUpdate is covered in auto-update.test.ts)
*/
import { afterEach, beforeEach, describe, expect, it, mock, spyOn } from "bun:test";
@ -15,7 +16,7 @@ const clackMocks = mockClackPrompts({
});
// Must import after mock.module for @clack/prompts
const { offerGithubAuth, createCloudAgents, setupAutoUpdate } = await import("../shared/agent-setup.js");
const { offerGithubAuth, createCloudAgents } = await import("../shared/agent-setup.js");
let stderrSpy: ReturnType<typeof spyOn>;
@ -84,34 +85,6 @@ describe("offerGithubAuth", () => {
});
});
// ── setupAutoUpdate ────────────────────────────────────────────────────
describe("setupAutoUpdate", () => {
it("runs update setup commands on the remote", async () => {
const runner = {
runServer: mock(() => Promise.resolve()),
uploadFile: mock(() => Promise.resolve()),
downloadFile: mock(() => Promise.resolve()),
};
await setupAutoUpdate(runner, "claude", "npm update -g @anthropic-ai/claude-code");
expect(runner.runServer).toHaveBeenCalled();
// Should have been called with a command containing the update cmd
const calls = runner.runServer.mock.calls;
const allCmds = calls.map((c: unknown[]) => String(c[0])).join(" ");
expect(allCmds).toContain("systemd");
});
it("handles failure gracefully", async () => {
const runner = {
runServer: mock(() => Promise.reject(new Error("failed"))),
uploadFile: mock(() => Promise.resolve()),
downloadFile: mock(() => Promise.resolve()),
};
// Should not throw
await setupAutoUpdate(runner, "agent", "update-cmd");
});
});
// ── createCloudAgents ──────────────────────────────────────────────────
describe("createCloudAgents", () => {

View file

@ -357,64 +357,6 @@ describe("digitalocean/listServers", () => {
});
});
// ─── findSpawnSnapshot ───────────────────────────────────────────────────────
describe("digitalocean/findSpawnSnapshot", () => {
it("returns null when no snapshots found", async () => {
global.fetch = mock(() =>
Promise.resolve(
new Response(
JSON.stringify({
images: [],
}),
),
),
);
const { findSpawnSnapshot } = await import("../digitalocean/digitalocean");
const result = await findSpawnSnapshot("claude");
expect(result).toBeNull();
});
it("returns latest snapshot ID", async () => {
const resp = {
images: [
{
id: 100,
name: "spawn-claude-v1",
created_at: "2025-01-01T00:00:00Z",
},
{
id: 200,
name: "spawn-claude-v2",
created_at: "2025-06-01T00:00:00Z",
},
{
id: 300,
name: "spawn-other-v1",
created_at: "2025-12-01T00:00:00Z",
},
],
};
global.fetch = mock(() => Promise.resolve(new Response(JSON.stringify(resp))));
const { findSpawnSnapshot } = await import("../digitalocean/digitalocean");
const result = await findSpawnSnapshot("claude");
expect(result).toBe("200");
});
it("returns null on API error", async () => {
global.fetch = mock(() =>
Promise.resolve(
new Response("error", {
status: 500,
}),
),
);
const { findSpawnSnapshot } = await import("../digitalocean/digitalocean");
const result = await findSpawnSnapshot("claude");
expect(result).toBeNull();
});
});
// ─── promptSwitchAccount ─────────────────────────────────────────────────────
describe("digitalocean/promptSwitchAccount", () => {