- Rename package to @alkdev/typemap, update peerDeps to @alkdev/typebox - Replace all @sinclair/typebox imports with @alkdev/typebox - Replace @sinclair/hammer build system with standalone build.mjs - Remove upstream-only files (.github, .vscode, design/, typemap.png) - Update readme with fork notice and new package names - Add fork copyright to license
33 lines
1.0 KiB
TypeScript
33 lines
1.0 KiB
TypeScript
import { Assert } from './assert'
|
|
import { TypeBox, Valibot, Zod } from '@alkdev/typemap'
|
|
import { KindGuard } from '@alkdev/typebox'
|
|
|
|
describe('Parameters', () => {
|
|
it('Should map Parameters (Zod)', () => {
|
|
const A = TypeBox('string')
|
|
const B = Zod({ A }, 'A')
|
|
const C = TypeBox(B)
|
|
Assert.IsTrue(KindGuard.IsString(C))
|
|
})
|
|
it('Should map Parameters (Valibot)', () => {
|
|
const A = TypeBox('string')
|
|
const B = Valibot({ A }, 'A')
|
|
const C = TypeBox(B)
|
|
Assert.IsTrue(KindGuard.IsString(C))
|
|
})
|
|
it('Should map Parameters With Constraints (Zod)', () => {
|
|
const A = TypeBox('string', { minLength: 10 })
|
|
const B = Zod({ A }, 'A')
|
|
const C = TypeBox(B)
|
|
Assert.IsTrue(KindGuard.IsString(C))
|
|
Assert.IsEqual(C.minLength, 10)
|
|
})
|
|
it('Should map Parameters With Constraints (Valibot)', () => {
|
|
const A = TypeBox('string', { minLength: 10 })
|
|
const B = Valibot({ A }, 'A')
|
|
const C = TypeBox(B)
|
|
Assert.IsTrue(KindGuard.IsString(C))
|
|
Assert.IsEqual(C.minLength, 10)
|
|
})
|
|
})
|