validator/types/boolean.test.js
Jay 46b19757bd
All checks were successful
continuous-integration/drone/push Build is passing
[feat] add string type pattern check, add object child check
2020-06-10 13:32:50 +00:00

20 lines
473 B
JavaScript

/* eslint-disable no-undef */
const TypeBoolean = require('./boolean.js')
describe('test validate schema type boolean', () => {
function throwFunc (val) {
return () => {
if (val) throw new Error(val)
}
}
it('test type boolean required', async () => {
const bool = new TypeBoolean().required()
throwFunc(bool.validate(true))
expect(throwFunc(bool.validate(undefined))).toThrow()
expect(throwFunc(bool.validate({}))).toThrow()
})
})