Revision 0.8.4 (#13)
* Parameterized Types * Syntax Options * Documentation
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import './options'
|
||||
import './parameters'
|
||||
import './typebox-from-zod'
|
||||
import './typebox-from-valibot'
|
||||
import './valibot-from-typebox'
|
||||
|
||||
17
test/options.ts
Normal file
17
test/options.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import { Assert } from './assert'
|
||||
import { TypeBox, Valibot, Zod } from '@sinclair/typemap'
|
||||
|
||||
describe('SyntaxOptions', () => {
|
||||
it('Should map Options (Zod)', () => {
|
||||
const A = TypeBox('string', { minLength: 10 })
|
||||
const B = Zod(A)
|
||||
const C = TypeBox(B)
|
||||
Assert.IsEqual(C.minLength, 10)
|
||||
})
|
||||
it('Should map Options (Valibot)', () => {
|
||||
const A = TypeBox('string', { minLength: 10 })
|
||||
const B = Valibot(A)
|
||||
const C = TypeBox(B)
|
||||
Assert.IsEqual(C.minLength, 10)
|
||||
})
|
||||
})
|
||||
32
test/parameters.ts
Normal file
32
test/parameters.ts
Normal file
@@ -0,0 +1,32 @@
|
||||
import { Assert } from './assert'
|
||||
import { TypeBox, Valibot, Zod } from '@sinclair/typemap'
|
||||
import { KindGuard } from '@sinclair/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)
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user