Skip to content

Commit e0d2839

Browse files
committed
test(utils): add invalid hex color fallback tests
1 parent 29a052c commit e0d2839

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

lib/svg/sanitizer.test.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,12 @@ describe('SVG Sanitizer Utilities', () => {
4949
expect(sanitizeHexColor('"><script>', '000000')).toBe('000000');
5050
});
5151

52+
it('returns fallback for invalid hex names', () => {
53+
expect(sanitizeHexColor('red', '000000')).toBe('000000');
54+
expect(sanitizeHexColor('blue', '000000')).toBe('000000');
55+
expect(sanitizeHexColor('green', '000000')).toBe('000000');
56+
});
57+
5258
it('returns fallback for null/undefined', () => {
5359
expect(sanitizeHexColor(null, '000000')).toBe('000000');
5460
expect(sanitizeHexColor(undefined, '000000')).toBe('000000');

0 commit comments

Comments
 (0)