Skip to content

Commit 0ea7f74

Browse files
authored
test(utils): check boundary robustness of username length truncator (Variation 4) (JhaSourav07#1607)
## Description Fixes JhaSourav07#1583 ## 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 layout safety unit test targeting username truncation text length configurations). ## Checklist before requesting a review: - [x] I have read the `CONTRIBUTING.md` file. - [x] I have tested these changes locally. - [x] My commits follow the Conventional Commits format (`test(utils): ...`).
2 parents 2134fca + ad9c5db commit 0ea7f74

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

lib/svg/generator.test.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -808,6 +808,20 @@ describe('generateSVG', () => {
808808
expect(svg).toContain('class="isometric-labels"');
809809
expect(svg).toContain('fill="var(--cp-text)"');
810810
});
811+
812+
it('verify boundary robustness of username length truncator (Variation 4)', () => {
813+
const extendedLongUsername = 'abcdefghijklmnopqrstuvwxyz1234567890';
814+
const extendedParams = {
815+
user: extendedLongUsername,
816+
hide_title: false,
817+
} as unknown as BadgeParams;
818+
819+
const svg = generateSVG(mockStats, extendedParams, mockCalendar);
820+
821+
expect(extendedLongUsername.length).toBeGreaterThan(30);
822+
expect(svg).toContain('ABCDEFGHIJKL...');
823+
expect(svg).not.toContain('ABCDEFGHIJKLMNOPQRSTUVWXYZ');
824+
});
811825
});
812826
});
813827

0 commit comments

Comments
 (0)