Skip to content

Commit b2ab7ef

Browse files
authored
test(ComparisonStatsCard): verify progress bar split for equal values (JhaSourav07#1166)
## Description Fixes JhaSourav07#1068 ## Pillar - [ ] 🎨 Pillar 1 — New Theme Design - [ ] 📐 Pillar 2 — Geometric SVG Improvement - [ ] 🕐 Pillar 3 — Timezone Logic Optimization - [x] 🛠️ Other (Bug fix, refactoring, docs, testing) ## Visual Preview No visual changes (Pure component UI validation progress bar test coverage improvement). ## Checklist before requesting a review: - [x] I have read the `CONTRIBUTING.md` file. - [x] I have tested these changes locally. - [x] I have run the isolated file prettier formatter. - [x] My commits follow the Conventional Commits format (`test(ComparisonStatsCard): ...`). - [x] I have made sure that I have only one clean commit to merge in this PR. - [x] The SVG output matches the CommitPulse "premium quality" aesthetic standard.
2 parents 35fb17e + fb9f532 commit b2ab7ef

1 file changed

Lines changed: 26 additions & 0 deletions

File tree

components/dashboard/ComparisonStatsCard.test.tsx

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,4 +125,30 @@ describe('ComparisonStatsCard', () => {
125125
expect(userOneSegment).toBeDefined();
126126
expect(userTwoSegment).toBeDefined();
127127
});
128+
129+
it('renders a balanced 50/50 split progress bar without any emerald color highlight when values are equal', () => {
130+
const { container } = render(
131+
<ComparisonStatsCard
132+
title="Developer Score"
133+
valueA={50}
134+
valueB={50}
135+
labelA="User One"
136+
labelB="User Two"
137+
icon="Award"
138+
/>
139+
);
140+
141+
const progressSegments = container.querySelectorAll(
142+
'.w-full.bg-gray-700\\/50 div, .relative div'
143+
);
144+
145+
const allDivs = Array.from(container.querySelectorAll('div'));
146+
147+
const emeraldElement =
148+
container.querySelector('[className*="emerald"]') ||
149+
container.querySelector('.text-emerald-400');
150+
151+
expect(emeraldElement).toBeNull();
152+
expect(screen.queryByText('Winner')).toBeNull();
153+
});
128154
});

0 commit comments

Comments
 (0)