import { expectTypeOf } from 'vitest' import type { InferInput, IsLiteralUnion } from './utils' describe('IsLiteralUnion', () => { it('should return true for literal union types', () => { expectTypeOf>().toEqualTypeOf() }) it('should return false for single literal', () => { expectTypeOf>().toEqualTypeOf() }) it('should return false for wide string type', () => { expectTypeOf>().toEqualTypeOf() }) it('should return true for literal union with undefined', () => { expectTypeOf>().toEqualTypeOf() }) }) describe('InferInput', () => { it('should preserve literal union types for query', () => { expectTypeOf>().toEqualTypeOf<{ orderBy: 'asc' | 'desc' }>() }) it('should convert string to string | string[] for query', () => { expectTypeOf>().toEqualTypeOf<{ page: string | string[] }>() }) it('should convert number to string | string[] for query', () => { expectTypeOf>().toEqualTypeOf<{ page: string | string[] }>() }) it('should preserve optional union (T | undefined) for query', () => { expectTypeOf>().toEqualTypeOf<{ name?: string | undefined }>() }) it('should preserve literal union with undefined for query', () => { expectTypeOf>().toEqualTypeOf<{ orderBy?: 'asc' | 'desc' | undefined }>() }) it('should convert unknown to string | string[] for query (coerce support)', () => { expectTypeOf>().toEqualTypeOf<{ page: string | string[] }>() }) it('should handle object | undefined for query (optional schema)', () => { expectTypeOf>().toEqualTypeOf< { name?: string | undefined } | undefined >() }) it('should convert string to string for param', () => { expectTypeOf>().toEqualTypeOf<{ id: string }>() }) it('should convert string to string for header', () => { expectTypeOf>().toEqualTypeOf<{ authorization: string }>() }) it('should convert string to string for cookie', () => { expectTypeOf>().toEqualTypeOf<{ session: string }>() }) })