refactor: standardize test mocks to use shared mock files#108
Merged
kevinrutledge merged 5 commits intodevelopfrom Apr 5, 2026
Merged
refactor: standardize test mocks to use shared mock files#108kevinrutledge merged 5 commits intodevelopfrom
kevinrutledge merged 5 commits intodevelopfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Developer
Kevin Rutledge
What changed?
Standardized test mock patterns across the codebase. Three files were using inline mocks where shared mock files already exist.
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.
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.
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
Checklist