Add testing infrastructure and 166 tests#292
Merged
Merged
Conversation
Install vitest, @testing-library/react, @testing-library/jest-dom, @testing-library/user-event, jsdom, and @vitest/coverage-v8. Create vitest.config.ts (separate from vite.config.ts to avoid reactRouter plugin issues), setup file with jest-dom matchers and matchMedia mock, TypeScript globals reference, test helper for rendering components with router context via createRoutesStub, and npm scripts for test, test:run, and test:coverage.
Test cn, classNames, formatDate, formatName, generateRandomInt, toTitleCase, workshop status utils (hasHappened, isUpcoming, isNew), and path utils (getOgGeneratorUrl, setActiveClassForPath).
Test useMediaQuery and usePrefersReducedMotion hooks with mocked matchMedia responses and state assertions.
Test Chip, Button (variants, sizes, asChild, ref forwarding), Skeleton, AlertBanner (5 variant types), ProBadge, UserAvatar (pro/team badges, fallback URLs), PriceCard compound component (Title, Pricing, Features, Coupon interaction, Divider), and ChallengeCard (links, chips, avatar count, soon status).
Test Error500, NotFound, form Input, LoadingButton (idle/loading/ submitting/success states), WhatsApp button, LinkToLoginWithRedirect (redirect logic, password-reset edge case), ranking badge SVGs, Wave (top/bottom variants), and BackgroundBlur.
Test Blog route (stubbed loader with async rendering), BlogPostCard (Link href, router context), Ranking (loader data, filter links), Codando com IA checkout (paid/pending/denied/error states, boleto flow), and Agenda (events list, type filters, empty state).
GitHub Actions workflow that runs on pull requests and pushes to main. Installs dependencies, runs the test suite, and generates coverage.
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.
Summary
What's tested
Key patterns established
renderWithRouterhelper usingcreateRoutesStubfor components that need router contextvi.mock()for server modules (.server.ts) to prevent env var validation at import timevi.mock()foruseOutletContextwhen components depend on user contextfindByTextfor stubbed loadersTest plan
npm run test:run— 166 tests passnpm run test:coverage— coverage report generates🤖 Generated with Claude Code