Fix routing, add tests#4
Merged
Merged
Conversation
Test stack: vitest + @testing-library/react, covering routing, useSignaling hook, HostView/PeerView signaling + WebRTC flows, and AudioVisualizer lifecycle. Also migrates the client from prop-drilling navigation (onBack, initialRoomCode) to React Router v6 with HashRouter, which the tests depend on for proper route param and navigation testing. CI: adds a parallel test-client job to the test workflow. Pre-push: extends .githooks/pre-push to run client tests after the existing server tests. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR migrates the client UI from prop-driven navigation to React Router (HashRouter) and adds a Vitest + Testing Library test suite covering routing, signaling, and key WebRTC/UI flows, alongside CI/local hook updates to run the new client tests.
Changes:
- Add Vitest/jsdom test infrastructure and component/hook test coverage for routing + signaling + WebRTC flows.
- Migrate client navigation to React Router with
HashRouter, route params (/listen/:roomId), anduseNavigateback navigation. - Update CI workflow and pre-push hook to run client tests in addition to server tests.
Reviewed changes
Copilot reviewed 15 out of 16 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| client/vite.config.js | Enables Vitest with jsdom + global setup file. |
| client/src/test-setup.js | Adds jsdom stubs for canvas/audio/WebRTC to support component tests. |
| client/src/main.jsx | Wraps app with HashRouter for hash-based routing. |
| client/src/hooks/useSignaling.test.js | Adds hook tests for WebSocket lifecycle + reconnect behavior. |
| client/src/components/PeerView.test.jsx | Adds PeerView tests for routing param behavior, UI states, and WebRTC signaling flow. |
| client/src/components/PeerView.jsx | Switches to router params + useNavigate for back navigation. |
| client/src/components/HostView.test.jsx | Adds HostView tests for signaling states, capture errors, clipboard, and WebRTC offer/ICE/answer flow. |
| client/src/components/HostView.jsx | Switches to useNavigate for back navigation and updates shared link to hash route. |
| client/src/components/AudioVisualizer.test.jsx | Adds lifecycle tests for AudioVisualizer (AudioContext setup/teardown). |
| client/src/App.test.jsx | Adds routing/navigation tests for the new route structure. |
| client/src/App.jsx | Replaces mode state with <Routes> and a Landing component using useNavigate. |
| client/package.json | Adds react-router-dom + testing dependencies and test scripts. |
| client/pnpm-lock.yaml | Locks new dependencies (router + vitest + testing libs). |
| README.md | Documents how to run the new client/server test suites. |
| .github/workflows/test.yml | Adds a parallel client test job using pnpm + Node 24. |
| .githooks/pre-push | Runs both server and client tests before pushing. |
Files not reviewed (1)
- client/pnpm-lock.yaml: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Contributor
Co-authored-by: afraser <1179515+afraser@users.noreply.github.com>
Contributor
Contributor
Pin pnpm version and enforce frozen lockfile in CI
…nto feat/client-test-suite
Replace wildcard "*" specifiers with the actual installed ^major.minor.patch versions. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.
Test stack: vitest + @testing-library/react, covering routing, useSignaling hook, HostView/PeerView signaling + WebRTC flows, and AudioVisualizer lifecycle.
Also migrates the client from prop-drilling navigation (onBack, initialRoomCode) to React Router v7 with HashRouter, which the tests depend on for proper route param and navigation testing.
CI: adds a parallel test-client job to the test workflow. Pre-push: extends .githooks/pre-push to run client tests after the existing server tests.