Skip to content

Commit 3bbb5cc

Browse files
authored
test(theme-switch): add type compiler validation coverage (JhaSourav07#3135)
## Description Fixes JhaSourav07#2842 Added `app/components/theme-switch.type-compiler.test.tsx` to provide TypeScript compiler validation coverage for the Theme Switch component. ### Coverage Added * AnimationVariant type validation * AnimationStart type validation * createAnimation return structure validation * Optional parameter compatibility checks * Valid exported type usage validation ## Pillar * [ ] 🎨 Pillar 1 — New Theme Design * [ ] 📐 Pillar 2 — Geometric SVG Improvement * [ ] 🕐 Pillar 3 — Timezone Logic Optimization * [x] 🛠️ Other (Bug fix, refactoring, docs) ## Visual Preview Attached screenshot showing successful execution of all 5 test cases. <img width="1200" height="287" alt="Screenshot 2026-06-02 161617" src="https://github.com/user-attachments/assets/5f0f2db8-97f4-4b58-bf2b-a2a86e169b38" /> ## Checklist * [x] I have read the `CONTRIBUTING.md` file. * [x] I have tested these changes locally. * [x] My commits follow the Conventional Commits format. * [x] I have made sure that I have only one commit to merge in this PR.
2 parents 12cabe8 + 4f03a3b commit 3bbb5cc

1 file changed

Lines changed: 38 additions & 0 deletions

File tree

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import { describe, expectTypeOf, it } from 'vitest';
2+
import { createAnimation, type AnimationStart, type AnimationVariant } from './theme-switch';
3+
4+
describe('ThemeSwitch Type Compiler Validation', () => {
5+
it('validates AnimationVariant union values', () => {
6+
expectTypeOf<AnimationVariant>().toEqualTypeOf<
7+
'circle' | 'rectangle' | 'gif' | 'polygon' | 'circle-blur'
8+
>();
9+
});
10+
11+
it('validates AnimationStart type', () => {
12+
expectTypeOf<AnimationStart>().toBeString();
13+
});
14+
15+
it('ensures createAnimation returns required structure', () => {
16+
const animation = createAnimation('circle');
17+
18+
expectTypeOf(animation.name).toBeString();
19+
expectTypeOf(animation.css).toBeString();
20+
});
21+
22+
it('accepts optional parameters without compile errors', () => {
23+
const animation = createAnimation('circle');
24+
25+
expectTypeOf(animation.name).toBeString();
26+
expectTypeOf(animation.css).toBeString();
27+
});
28+
29+
it('accepts valid exported types in createAnimation', () => {
30+
const variant: AnimationVariant = 'circle';
31+
const start: AnimationStart = 'center';
32+
33+
const animation = createAnimation(variant, start);
34+
35+
expectTypeOf(animation.name).toBeString();
36+
expectTypeOf(animation.css).toBeString();
37+
});
38+
});

0 commit comments

Comments
 (0)