Skip to content

Fix pre-existing typecheck failures in register tests (CLI-FND-002) - #39

Open
cryptoxdog wants to merge 1 commit into
claude/new-session-br7qjb-phase-3from
claude/fix-register-test-types
Open

Fix pre-existing typecheck failures in register tests (CLI-FND-002)#39
cryptoxdog wants to merge 1 commit into
claude/new-session-br7qjb-phase-3from
claude/fix-register-test-types

Conversation

@cryptoxdog

Copy link
Copy Markdown
Collaborator

Stacked PR — quality fix on top of #38

Stacked on #38 (Phase 3). Base is claude/new-session-br7qjb-phase-3; this PR's diff shows only the register-test fix. Retarget to main once the stack lands.

Problem

npm run typecheck (the assurance typecheck gate uses tsconfig.check.json, which includes tests/) fails with 3 pre-existing TS2493 errors — present at base 0a660de, unrelated to any prior PR in this stack:

tests/api/register-enriched.e2e.test.ts(100,47): error TS2493
tests/api/register-enriched.e2e.test.ts(115,47): error TS2493
tests/api/register.test.ts(59,47): error TS2493

Each is a valuesMock.mock.calls[0][0] read (the first insert().values(...) argument). valuesMock was defined as vi.fn(() => ({ … })) — a zero-argument implementation — so vitest infers its call-args as the empty tuple [], and indexing [0] on a length-0 tuple is a compile error.

Fix

Declare the argument the mock actually receives:

const valuesMock = vi.fn((_values: Record<string, unknown>) => ({ onConflictDoUpdate: onConflictDoUpdateMock }));

Now mock.calls[0] is a non-empty tuple and [0] typechecks. No runtime or behavior change — the impl still returns the same chain object; the register suites pass unchanged (13 tests).

Evidence

  • npm run typecheckexit 0, 0 errors (was 3).
  • NODE_ENV=test vitest run149/149.

This is the fix for finding CLI-FND-002 recorded in the unthrottle pack.


Generated by Claude Code

The `typecheck` gate (tsconfig.check.json, which includes tests/) failed with
3 TS2493 errors: `valuesMock.mock.calls[0][0]` indexed the first insert arg,
but valuesMock was `vi.fn(() => …)` with a zero-arg implementation, so its call
args were inferred as the empty tuple `[]` — index 0 is a compile error.

Declare the argument the mock actually receives
(`(_values: Record<string, unknown>) => …`) so `mock.calls[0]` is a
non-empty tuple. No runtime/behavior change; the register suites still pass
(13 tests). This clears the last 3 errors so `npm run typecheck` exits 0.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SjcHn8jZErKo37ZJi6qybX
@sonarqubecloud

Copy link
Copy Markdown

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