2
2
mirror of https://github.com/Thream/website.git synced 2024-07-21 09:28:32 +02:00
website/hooks/useForm/handleCheckboxBoolean.test.ts

23 lines
531 B
TypeScript

import { Type } from '@sinclair/typebox'
import { handleCheckboxBoolean } from './handleCheckboxBoolean'
const schema = Type.Object({
myBoolean: Type.Boolean(),
myString: Type.String()
})
describe('hooks/useForm/handleCheckboxBoolean', () => {
it('should convert all checkbox property to boolean', () => {
const object = {
myBoolean: 'on',
myString: 'on'
}
const result = handleCheckboxBoolean(object, schema)
expect(result).toEqual({
myBoolean: true,
myString: 'on'
})
})
})