test: realign onboarding + upload component tests with current UI - #52
Conversation
FileUpload:
- Component button is "Choose File" (singular) and only opens the hidden
<input type="file" />, so target the input directly with user.upload
instead of getByRole('button', /choose files/i).
- "Upload to Cloud Storage" was renamed to "Upload Track".
- Heading is "Drag & drop your music" with subtext "or click below to
browse your files".
- The component performs no JS-level type/size validation in
handleFileSelect; type filtering is just the input's `accept`
attribute and size limits are enforced server-side. Replaced the two
validation cases with one assertion on `accept` and one that confirms
large files are accepted as-is.
- Switched fetch mockClear -> mockReset so leftover
mockResolvedValueOnce queue entries don't bleed across tests.
- Mock @heroui/ripple + @heroui/dom-animation locally so HeroUI Button
clicks don't trigger framer-motion's dynamic import (jsdom can't
resolve it without --experimental-vm-modules).
ClaimProfileStep:
- Mock @heroui/ripple + @heroui/dom-animation so the Claim button click
doesn't hit the framer-motion dynamic-import error.
- Description text is now "Search for your existing artist profile...",
not "Already have music on Flemoji".
- Switched fetch mockClear -> mockReset to clear leftover
mockResolvedValueOnce queue entries between tests (was causing the
"search failed" and "track artwork" cases to flake when the suite ran
end-to-end).
ArtistProfileWizard:
- HeroUI Button destructures useRipple() as { onPress, onClear, ripples }.
The old mock returned pointer handlers (onMouseDown/Up/etc.), so
onRipplePressHandler was undefined and every click threw
"onRipplePressHandler is not a function". Updated mock shape.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
Realigns three failing Jest suites with the current UI in
develop. No production code changes — drift between the tests and the components was the entire problem.<input type="file">, the file input — not the button — is the right target foruserEvent.upload. The upload button on the second screen was renamed to "Upload Track". The component no longer performs JS-level type/size validation, so the two validation tests were replaced with one that pins the input'sacceptattribute and one that confirms large files are accepted as-is.@heroui/ripple+@heroui/dom-animationso clicking the Claim button doesn't hit the framer-motion dynamic-import error in jsdom.@heroui/ripplemock returned pointer handlers, but the current HeroUI Button destructures{ onPress, onClear, ripples }— soonRipplePressHandlerwas undefined and every button click threw. Fixed the mock shape.Also switched
fetch.mockClear()->fetch.mockReset()in the two suites that usemockResolvedValueOnce, so leftover queue entries don't bleed between cases (caused "search failed" / "track artwork" / "upload errors" to flake when the suite ran end-to-end).Test plan
yarn test src/components/upload/__tests__/FileUpload.test.tsx --ci— 7/7 passyarn test src/components/onboarding/__tests__/ArtistProfileWizard.test.tsx --ci— 11/11 passyarn test src/components/onboarding/steps/__tests__/ClaimProfileStep.test.tsx --ci— 8/8 passyarn tsc --noEmit— only pre-existing error about generateddocs-index.generated.json, unchanged by this PR🤖 Generated with Claude Code