improvement(codebase): migrate tests to dbChainMock, extract react-query hooks#4234
improvement(codebase): migrate tests to dbChainMock, extract react-query hooks#4234waleedlatif1 wants to merge 3 commits intostagingfrom
Conversation
…ery hooks Migrate 97 test files to centralized dbChainMock/dbChainMockFns helpers from @sim/testing — removes hoisted chain-wiring boilerplate. Extend dbChainMock to cover insert/update/delete/transaction/execute patterns. Extract useGitHubStars and useVoiceSettings react-query hooks from inline fetches. Centralize additional mocks (authMockFns, hybridAuthMockFns) and update docs.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
PR SummaryMedium Risk Overview Refactors a large set of Vitest files to use Makes a couple of targeted runtime changes. The landing Reviewed by Cursor Bugbot for commit 96a0a83. Configure here. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 96a0a83. Configure here.
| throw new Error('Failed to fetch GitHub stars') | ||
| } | ||
| const data = await response.json() | ||
| return (data?.stars as string) ?? '' |
There was a problem hiding this comment.
Falsy stars value displays empty string instead of fallback
Low Severity
fetchGitHubStars returns (data?.stars as string) ?? '', and the component uses stars ?? INITIAL_STARS. Both use nullish coalescing (??), which doesn't catch empty strings. If the API ever returns a falsy-but-not-nullish stars value (e.g. ""), the component renders an empty string. The old code used data.stars || DEFAULT_STARS, which correctly fell back on any falsy value.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 96a0a83. Configure here.
|
Superseded by #4235 (rebased cleanly onto latest staging). |


Summary
dbChainMock/dbChainMockFns— remove hoisted chain-wiring boilerplatedbChainMockhelper in@sim/testingto cover insert/update/delete/transaction/execute patternsuseGitHubStarsanduseVoiceSettingsreact-query hooks from inline fetchesauthMockFns,hybridAuthMockFns) and update sim-testing docsType of Change
Testing
Tested manually — full test suite (300 files, 5310 tests) passes; type-check and lint pass across all 8 packages
Checklist