feat(#658): add a viewer composite to mock-services for MSW-regime tests - #715
Conversation
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 WalkthroughWalkthroughChangesViewer fixture and test adoption
Estimated code review effort: 3 (Moderate) | ~25 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@libs/testing/mock-services/src/create-viewer.ts`:
- Line 26: Update the avatar creation call in createViewer so config.avatar
cannot overwrite userID when its value is undefined; preserve user.id as the
fallback owner while still allowing an explicitly provided defined userID to be
honored.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 29d1047a-83c8-47f0-882b-62da9a11b73e
📒 Files selected for processing (14)
libs/game/idle-client/src/resync/run-resync.test.tslibs/game/idle-client/src/worker/create-worker-runtime.test.tslibs/game/idle-client/src/worker/flush-pending-stop.test.tslibs/game/idle-client/src/worker/handle-client-message.test.tslibs/game/idle-client/src/worker/handle-request-resync-message.test.tslibs/game/idle-client/src/worker/handle-set-failure-action-message.test.tslibs/game/idle-client/src/worker/handle-stop-activity-message.test.tslibs/game/idle-client/src/worker/run-continuation.test.tslibs/game/idle-client/src/worker/run-simulation.test.tslibs/testing/mock-services/src/create-viewer.test.tslibs/testing/mock-services/src/create-viewer.tslibs/testing/mock-services/src/db/avatar-collection.tslibs/testing/mock-services/src/db/index.tslibs/testing/mock-services/src/index.ts
Description
Closes #658
Adds a
createViewercomposite to@vers/mock-services— one call seeding a user row, a linked avatar row, and a test access token in the@msw/datastore — and adopts it across idle-client's worker and resync tests, replacing the inlined user/avatar seed blocks.user,avatar,token); tests keep building their own oRPC client, mirroring how the real-database viewer composite leaves client construction in-testuser/avataroverride bags pass through to the collections' defaults; the avatar's user linkage comes free, and an explicitavatar.userIDoverride still winsAvatarRowSchemafrom the db subpath so the composite's override types derive from the row schema, matching the user rowTesting
bun run typecheckpassesbun run testpassesbun run lintpasses