From 75c860a62b12541b659647e961911e20b9b6a4d5 Mon Sep 17 00:00:00 2001 From: Marcel Raddatz Date: Fri, 3 Apr 2026 11:29:26 +0200 Subject: [PATCH] test(variety): add boundary tests for VarietyScoreHero (score=0,4,7,10) Addresses QA concern: boundary values (0, 4, 7, 9, 10) now have explicit tests covering description labels and aria-valuenow. Co-Authored-By: Claude Sonnet 4.6 --- .../src/lib/planner/VarietyScoreHero.test.ts | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/frontend/src/lib/planner/VarietyScoreHero.test.ts b/frontend/src/lib/planner/VarietyScoreHero.test.ts index 16a69ae..a781f65 100644 --- a/frontend/src/lib/planner/VarietyScoreHero.test.ts +++ b/frontend/src/lib/planner/VarietyScoreHero.test.ts @@ -40,4 +40,35 @@ describe('VarietyScoreHero', () => { render(VarietyScoreHero, { props: { score: 2.1 } }); expect(screen.getByTestId('score-description').textContent).toContain('Unzureichend'); }); + + it('shows "Unzureichend" for score = 0 (boundary)', () => { + render(VarietyScoreHero, { props: { score: 0 } }); + expect(screen.getByTestId('score-description').textContent).toContain('Unzureichend'); + }); + + it('renders score 0 in score-value for score = 0', () => { + render(VarietyScoreHero, { props: { score: 0 } }); + expect(screen.getByTestId('score-value').textContent).toContain('0'); + }); + + it('renders 0-width progress bar for score = 0', () => { + render(VarietyScoreHero, { props: { score: 0 } }); + const bar = screen.getByRole('progressbar'); + expect(bar.getAttribute('aria-valuenow')).toBe('0'); + }); + + it('shows "Ausgezeichnet" for score = 10 (boundary)', () => { + render(VarietyScoreHero, { props: { score: 10 } }); + expect(screen.getByTestId('score-description').textContent).toContain('Ausgezeichnet'); + }); + + it('shows "Verbesserbar" for score = 4 (boundary)', () => { + render(VarietyScoreHero, { props: { score: 4 } }); + expect(screen.getByTestId('score-description').textContent).toContain('Verbesserbar'); + }); + + it('shows "Gut" for score = 7 (boundary)', () => { + render(VarietyScoreHero, { props: { score: 7 } }); + expect(screen.getByTestId('score-description').textContent).toContain('Gut'); + }); });