Category: Testing / DX
Difficulty: High
Description
There are zero tests in the codebase. No unit tests, no integration tests, no component tests. package.json has no test script. Given that all logic lives in contexts and hooks (no backend), the unit test surface is rich and important.
Technical Requirements
- Install
vitest, @testing-library/react, @testing-library/user-event, @testing-library/jest-dom, and jsdom
- Configure Vitest in
vite.config.ts with environment: 'jsdom' and coverage reporting
- Write tests for:
AuthContext (login/signup/logout/changePassword), BookingContext (bookSession/updateSessionStatus), ForumContext (createPost/addComment/likePost), MessageContext (createThread/sendMessage/markAsRead), useDebounce, search.ts, recommendations.ts
- Write component tests for:
BookingModal (renders, submits, shows success), PasswordStrength (renders correct strength indicator), AnimatedCounter (counts from 0 to target)
- Achieve ≥80% code coverage on all context files
- Add
"test": "vitest --run" and "test:coverage": "vitest run --coverage" to package.json
Acceptance Criteria
Deliverables
src/**/__tests__/*.test.ts(x) (min 25 test files)
- Updated
vite.config.ts
- Updated
package.json
Category: Testing / DX
Difficulty: High
Description
There are zero tests in the codebase. No unit tests, no integration tests, no component tests.
package.jsonhas no test script. Given that all logic lives in contexts and hooks (no backend), the unit test surface is rich and important.Technical Requirements
vitest,@testing-library/react,@testing-library/user-event,@testing-library/jest-dom, andjsdomvite.config.tswithenvironment: 'jsdom'and coverage reportingAuthContext(login/signup/logout/changePassword),BookingContext(bookSession/updateSessionStatus),ForumContext(createPost/addComment/likePost),MessageContext(createThread/sendMessage/markAsRead),useDebounce,search.ts,recommendations.tsBookingModal(renders, submits, shows success),PasswordStrength(renders correct strength indicator),AnimatedCounter(counts from 0 to target)"test": "vitest --run"and"test:coverage": "vitest run --coverage"topackage.jsonAcceptance Criteria
pnpm testruns all tests and passesAuthContextlogin tests cover: valid credentials, invalid credentials, demo usersForumContextlike toggle test verifies per-user behaviorany— all mocks are typedDeliverables
src/**/__tests__/*.test.ts(x)(min 25 test files)vite.config.tspackage.json