Skip to content

Commit 8678b6b

Browse files
test(RadarChart): verify language axis labels deduplicate for shared languages
1 parent a4dcf09 commit 8678b6b

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

components/dashboard/RadarChart.test.tsx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,17 @@ describe('RadarChart', () => {
7777
expect(screen.getAllByText('Python')).toBeDefined();
7878
});
7979

80+
it('deduplicates shared languages so TypeScript appears as a single axis label', () => {
81+
const langsA = [{ name: 'TypeScript', percentage: 70, color: '#3178c6' }];
82+
const langsB = [{ name: 'TypeScript', percentage: 50, color: '#3178c6' }];
83+
84+
render(<RadarChart languagesA={langsA} languagesB={langsB} labelA="User A" labelB="User B" />);
85+
86+
// TypeScript should appear exactly once as an axis label (SVG <text>) and once
87+
// in the bottom stats table — 2 total, not 4 (which would indicate two separate axes)
88+
expect(screen.getAllByText('TypeScript')).toHaveLength(2);
89+
});
90+
8091
it('scales axis points dynamically based on max score in data', () => {
8192
const highScoreLangs = [
8293
{ name: 'TypeScript', percentage: 100, color: '#3178c6' },

0 commit comments

Comments
 (0)