diff --git a/types/index.accessibility.test.ts b/types/index.accessibility.test.ts new file mode 100644 index 000000000..ea1171534 --- /dev/null +++ b/types/index.accessibility.test.ts @@ -0,0 +1,31 @@ +import { describe, it, expectTypeOf } from 'vitest'; +import type { BadgeSize, Scale, NotificationFrequency, BadgeParams, HexColor } from './index'; + +describe('Types Integrity & Validation Tests', () => { + it('1. correctly restricts Scale to specific valid literals', () => { + expectTypeOf().toEqualTypeOf<'linear' | 'log'>(); + expectTypeOf<'invalid'>().not.toMatchTypeOf(); + }); + + it('2. properly enforces NotificationFrequency literal unions', () => { + expectTypeOf().toEqualTypeOf<'realtime' | 'daily' | 'weekly'>(); + expectTypeOf<'monthly'>().not.toMatchTypeOf(); + }); + + it('3. validates BadgeSize string unions', () => { + expectTypeOf().toEqualTypeOf<'small' | 'medium' | 'large'>(); + expectTypeOf<'xl'>().not.toMatchTypeOf(); + }); + + it('4. ensures BadgeParams defines strict types for core properties', () => { + // Instead of creating partial objects, we directly inspect the type signatures + expectTypeOf().toBeString(); + expectTypeOf().toEqualTypeOf(); + expectTypeOf().toEqualTypeOf(); + }); + + it('5. confirms HexColor utilizes branding to prevent arbitrary string assignment', () => { + // Standard unbranded strings should not perfectly match the branded HexColor type + expectTypeOf().not.toEqualTypeOf(); + }); +});