Skip to content

Fix routing, add tests#4

Merged
afraser merged 10 commits into
mainfrom
feat/client-test-suite
Mar 4, 2026
Merged

Fix routing, add tests#4
afraser merged 10 commits into
mainfrom
feat/client-test-suite

Conversation

@afraser

@afraser afraser commented Mar 3, 2026

Copy link
Copy Markdown
Owner

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.

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>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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), and useNavigate back 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.

Comment thread client/src/hooks/useSignaling.test.js
Comment thread .github/workflows/test.yml
Comment thread client/src/components/PeerView.jsx Outdated
Comment thread client/src/App.jsx Outdated
Comment thread client/src/App.jsx Outdated
Comment thread client/package.json Outdated
Comment thread client/package.json
Comment thread README.md
Comment thread client/src/components/HostView.test.jsx Outdated

Copilot AI commented Mar 3, 2026

Copy link
Copy Markdown
Contributor

@afraser I've opened a new pull request, #5, to work on those changes. Once the pull request is ready, I'll request review from you.

Co-authored-by: afraser <1179515+afraser@users.noreply.github.com>

Copilot AI commented Mar 3, 2026

Copy link
Copy Markdown
Contributor

@afraser I've opened a new pull request, #6, to work on those changes. Once the pull request is ready, I'll request review from you.

Copilot AI commented Mar 3, 2026

Copy link
Copy Markdown
Contributor

@afraser I've opened a new pull request, #7, to work on those changes. Once the pull request is ready, I'll request review from you.

afraser and others added 6 commits March 3, 2026 20:36
Pin pnpm version and enforce frozen lockfile in CI
Replace wildcard "*" specifiers with the actual installed ^major.minor.patch versions.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@afraser
afraser merged commit 132f2ca into main Mar 4, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants