feat(tests): add shared mock factories and migrate heaviest test files#825
feat(tests): add shared mock factories and migrate heaviest test files#825
Conversation
|
Error: Model "claude-opus-4-6" is not compatible with the Codex engine. Configure a Codex-compatible model (e.g. "gpt-5.4") or switch to a different engine. Manual intervention may be required. |
|
@aaight review this |
|
Error: Model "claude-opus-4-6" is not compatible with the Codex engine. Configure a Codex-compatible model (e.g. "gpt-5.4") or switch to a different engine. Manual intervention may be required. |
|
@aaight review this, pretty please |
|
Your access token could not be refreshed because your refresh token was already used. Please log out and sign in again. Manual intervention may be required. |
|
@aaight review this PR |
|
Review findings:
I did not find another blocking issue in the migrated test files. 🕵️ codex · gpt-5.4 · run details |
|
@aaight tests/helpers/sharedMocks.ts:90 |
|
Aligned \ to the real \ surface and pushed it in e80b967. The shared mock now includes the actual exported methods that were missing, removes the non-existent ones, and is guarded with \ so future drift is caught by typecheck.\n\nVerification I ran here:\n- \n- \n- ✓ |unit-api| tests/unit/router/adapters/github.test.ts (24 tests) 60ms Test Files 3 passed (3) 🕵️ codex · gpt-5.4 · run details |
|
Aligned The shared mock now includes the actual exported methods that were missing, removes the non-existent ones, and is guarded with Verification I ran here:
I also ran 🕵️ codex · gpt-5.4 · run details |
nhopeatall
left a comment
There was a problem hiding this comment.
LGTM - the shared mock helpers preserve the export shapes used by the migrated tests, the touched test set passes (140/140), and I did not find any architectural or behavioral regressions in the refactor.
🕵️ codex · gpt-5.4 · run details
Summary
tests/helpers/sharedMocks.tswith reusable mock factory objects for the 5 most-mocked modules across the test suite (~813 total vi.mock() calls)What was implemented
tests/helpers/sharedMocks.ts(new file)Exports reusable mock objects for the top 5 mocked modules:
mockLogger(src/utils/logging.js, ~47 files),mockConfigProvider(src/config/provider.js, ~26 files),mockGitHubClientModule+mockWithGitHubToken(src/github/client.js, ~19 files),mockTriggerCheckModule(src/triggers/shared/trigger-check.js, ~17 files),mockDbClientModule(src/db/client.js, ~18 files).Migrated test files (5 files)
tests/unit/backends/adapter.test.ts(18 vi.mock calls) - uses mockLogger, mockConfigProvider, mockWithGitHubTokentests/unit/triggers/agent-execution.test.ts- uses mockLogger, mockTriggerCheckModuletests/unit/triggers/status-changed.test.ts- uses mockLogger, mockTriggerCheckModuletests/unit/triggers/check-suite-success.test.ts- uses mockTriggerCheckModule, mockGitHubClientModuletests/unit/router/adapters/github.test.ts(18 vi.mock calls) - uses mockLogger, mockConfigProvider, mockWithGitHubTokenKey decisions
Test plan
Generated with Claude Code
🕵️ claude-code · claude-sonnet-4-6 · run details