Add admin frontend tests#980
Conversation
|
Warning Review limit reached
More reviews will be available in 51 minutes and 34 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits. 🚦 How do rate limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (7)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Code Review
This pull request introduces a testing framework to the web admin frontend by adding Vitest, React Testing Library, and JSDOM, along with test suites for application routing, login functionality, and the API client. The review feedback highlights two key issues: a potential race condition in App.test.tsx caused by typing a newline character immediately before clicking the submit button, and the exclusion of test files from tsconfig.app.json, which prevents them from being type-checked during CI runs.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| await user.type(screen.getByLabelText("Secret key"), " SECRET_TEST\n"); | ||
| await user.click(screen.getByRole("button", { name: "Sign in" })); |
There was a problem hiding this comment.
Typing \n at the end of the secret key triggers an implicit form submission (Enter key press) in HTML forms. Immediately following this with user.click on the submit button can lead to a race condition:
- If the first submission starts and disables the button asynchronously,
user.clickmight throw an error or be ignored depending on timing. - If the button is not yet disabled when clicked, the form will be submitted a second time, triggering a duplicate API call. Since
fetchMockis only mocked once, the second call will resolve toundefinedand cause unexpected test failures or unhandled rejections.
To prevent this flakiness, remove the trailing \n from the typed secret key.
| await user.type(screen.getByLabelText("Secret key"), " SECRET_TEST\n"); | |
| await user.click(screen.getByRole("button", { name: "Sign in" })); | |
| await user.type(screen.getByLabelText("Secret key"), " SECRET_TEST "); | |
| await user.click(screen.getByRole("button", { name: "Sign in" })); |
| "include": ["src"], | ||
| "exclude": ["src/**/*.test.ts", "src/**/*.test.tsx", "src/test/**"] |
There was a problem hiding this comment.
Excluding test files from tsconfig.app.json without referencing them in another TypeScript configuration means they will be completely skipped during type-checking (e.g., when running npm run lint, which executes tsc -b --noEmit). This can allow type errors in test files to go unnoticed in CI.
Since Vite's production build only bundles files reachable from the entry point anyway, it is safe and recommended to keep test files included in tsconfig.app.json so they are properly type-checked.
"include": ["src"]|
Addressed the stale Gemini findings on the latest pushed head.
Validation:
@codex review |
|
Codex Review: Didn't find any major issues. Keep it up! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Summary
Adds a dedicated Vitest setup for the admin React frontend and wires it into CI.
npm ci, TypeScript lint, Vitest, and production build.Validation
cd web/admin && npm run test:runcd web/admin && npm run lintcd web/admin && npm run build -- --outDir ../../.cache/admin-dist-testgit diff --check