Expand frontend test coverage for role-based admin routing and shared UI primitives - #51
Merged
Merged
Conversation
Copilot created this pull request from a session on behalf of
countercheck
May 30, 2026 12:10
View session
countercheck
marked this pull request as ready for review
May 31, 2026 00:59
Contributor
There was a problem hiding this comment.
Pull request overview
This PR expands Vitest/Testing Library coverage for the frontend’s role-gated /admin entry routing and a handful of shared UI primitives, improving confidence in navigation and accessibility behavior without changing production components.
Changes:
- Add
AdminApproute-selection tests covering/adminlanding behavior for author/reviewer/analyst/unknown roles, plus/admin/login. - Add a
RespondentLayoutshell rendering test (header + content slot). - Add UI primitive tests for
Alert,Card/CardBody,Field, andPageHeader(including ARIA roles and label association).
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| frontend/src/admin/AdminApp.test.tsx | Adds routing/redirect coverage for /admin and the open /admin/login route based on user roles. |
| frontend/src/RespondentLayout.test.tsx | Verifies the respondent-facing layout renders the branded header and children content. |
| frontend/src/ui/Primitives.test.tsx | Adds focused tests for shared UI components, including ARIA role expectations and label↔input association. |
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.
This PR addresses coverage gaps in the frontend by adding tests for previously untested route-selection logic and reusable presentation components. It improves confidence in role-gated navigation and shared UI behavior without changing production code.
Admin entry routing coverage
frontend/src/admin/AdminApp.test.tsxto exercise/adminlanding behavior by role:researcher/admin) render survey listreviewerredirects to PII reviewanalystredirects to My DB access/admin/login).Respondent shell coverage
frontend/src/RespondentLayout.test.tsxto verify branded shell rendering (header + content slot).Shared UI primitive coverage
frontend/src/ui/Primitives.test.tsxcovering:AlertARIA role behavior across tones (alertvsstatus)Card/CardBodycontent and class passthroughFieldlabel-input association and hint renderingPageHeadertitle/subtitle/actions rendering contract