Skip to content

test: Remove duplicate and theatrical tests#3089

Open
la14-1 wants to merge 7 commits intomainfrom
qa/dedup-scanner
Open

test: Remove duplicate and theatrical tests#3089
la14-1 wants to merge 7 commits intomainfrom
qa/dedup-scanner

Conversation

@la14-1
Copy link
Copy Markdown
Member

@la14-1 la14-1 commented Mar 29, 2026

Summary

  • Removed 3 theatrical tests from cmd-list-cov.test.ts that used weak toHaveBeenCalled() assertions with no content verification, all superseded by stronger tests in the same file
  • Strengthened 2 remaining cloud-filter tests to verify actual output content

Details

The removed tests called cmdList() and only checked expect(clack.logInfo).toHaveBeenCalled() or expect(consoleMocks.log).toHaveBeenCalled() — these only prove no exception was thrown, not that the function produces correct output.

Each removed test had a stronger equivalent already present in the same file:

  • "shows empty message when no history" (line 106) → "shows no spawns message without filters" checks msg.includes("No spawns recorded")
  • "shows filtered results with agent filter" (line 139) → "shows filtered footer with agent filter" checks actual footer content
  • "shows empty message with agent filter that matches nothing" (line 203) → "shows filter mismatch message with agent filter" checks msg.includes("No spawns found matching")

The 2 retained cloud-filter tests were upgraded from toHaveBeenCalled() to content assertions verifying actual output (server names, error messages).

Net: 3 tests removed, 2 tests strengthened. 1948/1948 tests pass.

-- qa/dedup-scanner

…l assertions

Replace the 'does not throw' test for showNonBillingError with three
real tests that verify logWarn/logInfo are called with correct args.
Adds coverage for the empty-billingUrl and empty-causes branches.

-- qa/dedup-scanner
@la14-1 la14-1 force-pushed the qa/dedup-scanner branch from e69c41d to 88cc613 Compare March 29, 2026 08:28
spawn-qa-bot and others added 6 commits March 29, 2026 16:20
Two tests in pull-history.test.ts verified only that cmdPullHistory does
not throw when skipping records with no connection info or empty IP. They
provided no signal about whether SSH was actually skipped.

Add spyOn(Bun, "spawn") assertions to both tests confirming no SSH
process is spawned — the critical behavior being tested.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Two tests used `if (!result.ok) { expect(result.error.message)... }` after
already asserting `expect(result.ok).toBe(false)`. This creates a pattern
where the inner expect is guarded by a condition the outer expect already
validates — if the outer expect is ever removed, the inner silently becomes
unreachable.

Restructure with `if (result.ok) { throw ... }` to narrow the type for
TypeScript while keeping the error message assertion unconditional.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Replace bare toHaveBeenCalled()/not.toThrow() assertions that only
verified no exception was thrown with real content-checking assertions:

- billing-guidance.test.ts: replace "does not throw" with 3 tests
  verifying logWarn/logInfo are called with correct args (cause list,
  billing URL, and empty-causes branch)
- cmd-status-cov.test.ts: 4 tests now verify JSON output content
  (state: "unknown" for unsupported clouds, missing server_id, no
  token; agent filter verifies correct agent in filtered output)
- cmd-update-cov.test.ts: "shows manual install command" now checks
  the output contains npm/bun/install rather than just toHaveBeenCalled
- cmd-run-cov.test.ts: "outputs plain text" now checks that the invalid
  identifier appears in output and JSON is not output
- orchestrate-cov.test.ts: "injects model env var" now decodes the
  base64 env block and verifies AGENT_MODEL is set to the correct value

Net: 1 test removed, 2 tests added (billing-guidance). 2014 pass.

-- qa/dedup-scanner
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant