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 <noreply@anthropic.com>
This commit is contained in:
@@ -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');
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user