Skip to content

refactor: standardize test mocks to use shared mock files#108

Merged
kevinrutledge merged 5 commits intodevelopfrom
refactor/test-mock-consistency
Apr 5, 2026
Merged

refactor: standardize test mocks to use shared mock files#108
kevinrutledge merged 5 commits intodevelopfrom
refactor/test-mock-consistency

Conversation

@kevinrutledge
Copy link
Copy Markdown
Collaborator

Developer

Kevin Rutledge

What changed?

Standardized test mock patterns across the codebase. Three files were using inline mocks where shared mock files already exist.

  1. contact-group.test.ts - replaced inline vi.mock() for next/cache and @/lib/dal with shared mock imports (import "../mocks/next-cache" and import "../mocks/dal"). Service mocks stay inline since they're only used in this one file. This was the oldest action test file (Feb 14) and was never updated when the shared mock pattern was adopted.

  2. encryption.ts mock - added beforeEach with vi.clearAllMocks() to clear call history between tests. Uses clearAllMocks (not resetAllMocks) because the passthrough implementations (encrypt returns input, blindIndex hashes) need to persist. Every other shared mock file with vi.fn() calls already had a reset hook.

  3. auth-flow.test.ts - removed stale TODO comment that duplicated a source-level TODO in src/actions/auth.ts. Test comments should not carry forward source-level implementation notes.

How to test

  1. Run npm test - 272 tests pass
  2. Run npm run build - succeeds

Checklist

@kevinrutledge kevinrutledge self-assigned this Apr 5, 2026
@kevinrutledge kevinrutledge merged commit 75ead19 into develop Apr 5, 2026
2 checks passed
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