Skip to content

Commit ad9c5db

Browse files
committed
test(utils): check boundary robustness of username length truncator (Variation 4)
1 parent a231edc commit ad9c5db

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)