Skip to content

Commit 23723d5

Browse files
authored
test(icons): add type compiler validation coverage (JhaSourav07#3123)
## Description Adds TypeScript compiler validation coverage for `app/components/Icons.tsx`. This PR introduces a new `Icons.type-compiler.test.tsx` test suite that verifies: * icon exports remain function components * icon components accept no parameters * return types remain consistent across all exported icons * exported typings remain stable Fixes JhaSourav07#2822 ## Pillar * [ ] 🎨 Pillar 1 — New Theme Design * [ ] 📐 Pillar 2 — Geometric SVG Improvement * [ ] 🕐 Pillar 3 — Timezone Logic Optimization * [x] 🛠️ Other (Bug fix, refactoring, docs) ## Visual Preview N/A (TypeScript compiler validation tests only) ## Checklist before requesting a review: * [x] I have read the `CONTRIBUTING.md` file. * [ ] I have tested these changes locally (`localhost:3000/api/streak?user=YOUR_USERNAME`). * [x] I have run `npm run format` and `npm run lint` locally and resolved all errors (CI will fail otherwise). * [x] My commits follow the Conventional Commits format (e.g., `feat(themes): ...`, `fix(calculate): ...`). * [ ] I have updated `README.md` if I added a new theme or URL parameter. * [x] I have started the repo. * [x] I have made sure that I have only one commit to merge in this PR. * [ ] The SVG output matches the CommitPulse "premium quality" aesthetic standard (no raw elements, smooth animations, correct fonts). * [ ] (Recommended) I joined the CommitPulse Discord community for contributor discussions, mentorship, and faster PR support.
2 parents 44aa647 + add3fb8 commit 23723d5

1 file changed

Lines changed: 45 additions & 0 deletions

File tree

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import { describe, expectTypeOf, it } from 'vitest';
2+
import { CopyIcon, ZapIcon, BoxIcon, CheckIcon, CloseIcon } from './Icons';
3+
4+
describe('Icons Type Compiler Validation', () => {
5+
it('exports icon components as functions', () => {
6+
expectTypeOf(CopyIcon).toBeFunction();
7+
expectTypeOf(ZapIcon).toBeFunction();
8+
expectTypeOf(BoxIcon).toBeFunction();
9+
expectTypeOf(CheckIcon).toBeFunction();
10+
expectTypeOf(CloseIcon).toBeFunction();
11+
});
12+
13+
it('accepts no parameters for icon components', () => {
14+
expectTypeOf(CopyIcon).parameters.toEqualTypeOf<[]>();
15+
expectTypeOf(ZapIcon).parameters.toEqualTypeOf<[]>();
16+
expectTypeOf(BoxIcon).parameters.toEqualTypeOf<[]>();
17+
expectTypeOf(CheckIcon).parameters.toEqualTypeOf<[]>();
18+
expectTypeOf(CloseIcon).parameters.toEqualTypeOf<[]>();
19+
});
20+
21+
it('all icon components return compatible types', () => {
22+
expectTypeOf<ReturnType<typeof CopyIcon>>().toEqualTypeOf<ReturnType<typeof ZapIcon>>();
23+
24+
expectTypeOf<ReturnType<typeof ZapIcon>>().toEqualTypeOf<ReturnType<typeof BoxIcon>>();
25+
26+
expectTypeOf<ReturnType<typeof BoxIcon>>().toEqualTypeOf<ReturnType<typeof CheckIcon>>();
27+
28+
expectTypeOf<ReturnType<typeof CheckIcon>>().toEqualTypeOf<ReturnType<typeof CloseIcon>>();
29+
});
30+
31+
it('maintains compatible return types across icons', () => {
32+
expectTypeOf<ReturnType<typeof CopyIcon>>().toEqualTypeOf<ReturnType<typeof ZapIcon>>();
33+
34+
expectTypeOf<ReturnType<typeof BoxIcon>>().toEqualTypeOf<ReturnType<typeof CheckIcon>>();
35+
36+
expectTypeOf<ReturnType<typeof CheckIcon>>().toEqualTypeOf<ReturnType<typeof CloseIcon>>();
37+
});
38+
39+
it('all icon components share the same callable signature', () => {
40+
expectTypeOf(CopyIcon).toEqualTypeOf<typeof ZapIcon>();
41+
expectTypeOf(ZapIcon).toEqualTypeOf<typeof BoxIcon>();
42+
expectTypeOf(BoxIcon).toEqualTypeOf<typeof CheckIcon>();
43+
expectTypeOf(CheckIcon).toEqualTypeOf<typeof CloseIcon>();
44+
});
45+
});

0 commit comments

Comments
 (0)