Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it('should validate a query (success case 1)', () => {
const Query = t.interface({
q: t.string,
})
const m = H.decodeQuery(Query.decode)
const c = new MockConnection(new MockRequest({}, 'q=tobi+ferret'))
return assertSuccess(m, c, { q: 'tobi ferret' }, [])
})
it('should validate a query (failure case)', () => {
const Query = t.interface({
q: t.number,
})
const m = H.decodeQuery(Query.decode)
const c = new MockConnection(new MockRequest({}, 'q=tobi+ferret'))
return assertFailure(m, c, errors => {
assert.deepStrictEqual(failure(errors), [
'Invalid value "tobi ferret" supplied to : { q: number }/q: number',
])
})
})
})