Commit af9e9b5
authored
π fix(tests): tighten ComplianceScoreBreakdownModal test scoping (kubestellar#7908) (kubestellar#7909)
Two Copilot review comments on merged PR kubestellar#7905:
1. **Line 400** β `getAllByText('Kubescape').length >= 2` / `getAllByText('Kyverno').length >= 2`
are too loose. Any extra rendering of those names anywhere in the modal
would satisfy the assertion, and the check doesn't actually verify the
per-tool bars exist. Replaced with a scoped lookup via the "By tool"
heading: grab the section container and use `within(section).getByText(...)`
so the assertion only accepts matches inside the per-tool list.
2. **Line 512** β `getByText('100')` is a broad assertion; any element rendering
"100" anywhere (score %, count, label) would pass. Replaced with a
value-label pairing check: locate the "Total Checks" label, walk up to
its StatBox parent, and assert "100" appears inside that StatBox.
Added `within` to the @testing-library/react import.
All 12 tests in the file continue to pass locally; `npm run build` green.
Fixes kubestellar#7908
Signed-off-by: Andy Anderson <andy@clubanderson.com>1 parent a51b693 commit af9e9b5
1 file changed
Lines changed: 17 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
| 9 | + | |
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| |||
394 | 394 | | |
395 | 395 | | |
396 | 396 | | |
397 | | - | |
398 | | - | |
399 | | - | |
400 | | - | |
401 | | - | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
402 | 406 | | |
403 | 407 | | |
404 | 408 | | |
| |||
508 | 512 | | |
509 | 513 | | |
510 | 514 | | |
511 | | - | |
512 | | - | |
513 | | - | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
514 | 522 | | |
515 | 523 | | |
516 | 524 | | |
| |||
0 commit comments