Vitest for ui_card - #2261
Conversation
|
Warning Review limit reached
Next review available in: 15 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?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 reviews. How do review 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 refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
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 |
|
Reviewed: clean single-file addition - focused vitest for the ui Card family (base classes, className merge, ref forwarding, onClick args, arbitrary props, empty children) across Card/CardHeader/etc. Branch base slightly predates 2259/2260 but the merge-base diff is exactly this one file, so nothing regresses. Merging on green. |
PR Summary by QodoAdd Vitest coverage for ui Card primitives
AI Description
Diagram
High-Level Assessment
Files changed (2)
|
| @@ -0,0 +1,367 @@ | |||
| import { describe, it, expect, vi } from "vitest"; | |||
| import { render, fireEvent, screen } from "@testing-library/react"; | |||
There was a problem hiding this comment.
WARNING: Unused import screen from @testing-library/react
The screen import is included but never referenced in the file. This triggers lint/TS warnings and can mask actual missing imports as the test suite grows.
| import { render, fireEvent, screen } from "@testing-library/react"; | |
| import { render, fireEvent } from "@testing-library/react"; |
Reply with @kilocode-bot fix it to have Kilo Code address this issue.
Code Review SummaryStatus: 1 Issue Found | Recommendation: Address before merge Overview
Issue Details (click to expand)WARNING
Files Reviewed (1 files)
Fix these issues in Kilo Cloud Reviewed by step-3.7-flash · Input: 44K · Output: 2.1K · Cached: 263.9K |
|
nemotron-ultra-kilo review VERDICT: Minor style issues, no blocking issues found.
Automated first-pass review by the nemotron-ultra-kilo lane. The lead still reviews before merge. |
|
nemotron-ultra-orB review VERDICT: Needs fixes - ref forwarding tests are incorrect, missing newline at EOF, and onClick tests on non-interactive elements
Automated first-pass review by the nemotron-ultra-orB lane. The lead still reviews before merge. |
Code Review by Qodo
1. Unused screen import
|
| import { describe, it, expect, vi } from "vitest"; | ||
| import { render, fireEvent, screen } from "@testing-library/react"; | ||
| import { Card, CardHeader, CardTitle, CardDescription, CardContent, CardFooter } from "../card"; |
There was a problem hiding this comment.
1. Unused screen import 🐞 Bug ⚙ Maintainability
screen is imported from @testing-library/react but never referenced in this test file, adding dead code and noise.
Agent Prompt
### Issue description
`screen` is imported but unused in `card.test.tsx`, which adds dead code and can trigger unused-import tooling.
### Issue Context
This file uses `container.firstChild` for element access and never calls `screen.*` APIs.
### Fix Focus Areas
- desktop/src/components/ui/__tests__/card.test.tsx[1-3]
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
| it("fires onClick with correct args", () => { | ||
| const handleClick = vi.fn(); | ||
| const { container } = render( | ||
| <Card data-testid="card" onClick={handleClick}> | ||
| <div>child</div> | ||
| </Card> | ||
| ); | ||
| const card = container.firstChild as HTMLElement; | ||
| fireEvent.click(card); | ||
| expect(handleClick).toHaveBeenCalledTimes(1); | ||
| }); |
There was a problem hiding this comment.
2. Misleading click test names 🐞 Bug ⚙ Maintainability
Multiple tests are titled "fires onClick with correct args" but only assert the handler call count, so the name overstates what is verified and can mislead future readers about coverage.
Agent Prompt
### Issue description
Several click-handler tests claim to validate "correct args" but only check `toHaveBeenCalledTimes(1)`. This mismatch makes the suite misleading.
### Issue Context
If the intent is only to verify the click calls the handler, rename the test(s). If the intent is to verify arguments, add an assertion on the event argument (e.g., `expect(handleClick).toHaveBeenCalledWith(expect.anything())` or check `mock.calls[0][0]` shape).
### Fix Focus Areas
- desktop/src/components/ui/__tests__/card.test.tsx[34-44]
- desktop/src/components/ui/__tests__/card.test.tsx[103-113]
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
|
nemotron-super review VERDICT: Pass
Automated first-pass review by the nemotron-super lane. The lead still reviews before merge. |
CARD TITLE (intent, not commit subject): Vitest for ui_card
Autonomous build of board card tsk-dgpyjk.
Files:
desktop/src/components/ui/tests/card.test.tsx | 367 +++++++++++++++++++++
desktop/src/hooks/use-server-notifications.test.ts | 228 -------------
tests/cluster/test_worker_capacity.py | 180 +++-------
3 files changed, 419 insertions(+), 356 deletions(-)