Skip to content

Commit e1a460d

Browse files
test: add language colors coverage
1 parent 5790627 commit e1a460d

1 file changed

Lines changed: 33 additions & 0 deletions

File tree

lib/svg/languageColors.test.ts

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import { describe, expect, it } from 'vitest';
2+
3+
import { LANGUAGE_COLORS } from './languageColors';
4+
5+
describe('LANGUAGE_COLORS', () => {
6+
it('contains the correct TypeScript color', () => {
7+
expect(LANGUAGE_COLORS.TypeScript).toBe('#3178c6');
8+
});
9+
10+
it('contains the correct JavaScript color', () => {
11+
expect(LANGUAGE_COLORS.JavaScript).toBe('#f1e05a');
12+
});
13+
14+
it('defines Python color', () => {
15+
expect(LANGUAGE_COLORS.Python).toBeDefined();
16+
});
17+
18+
it('uses valid 6-digit hex colors for every language', () => {
19+
for (const color of Object.values(LANGUAGE_COLORS)) {
20+
expect(color).toMatch(/^#[0-9a-fA-F]{6}$/);
21+
}
22+
});
23+
24+
it('contains at least 20 languages', () => {
25+
expect(Object.keys(LANGUAGE_COLORS).length).toBeGreaterThanOrEqual(20);
26+
});
27+
28+
it('does not contain empty language names', () => {
29+
for (const language of Object.keys(LANGUAGE_COLORS)) {
30+
expect(language.trim()).not.toBe('');
31+
}
32+
});
33+
});

0 commit comments

Comments
 (0)