|
| 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