Skip to content

Commit

Permalink
Fix validator additional test
Browse files Browse the repository at this point in the history
  • Loading branch information
afharo committed Dec 18, 2019
1 parent 3b930f3 commit e394259
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/core/server/http/router/validator/validator.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import { schema, Type } from '@kbn/config-schema';
describe('Router validator', () => {
it('should validate and infer the type from a function', () => {
const validator = RouteValidator.from({
params: (resolver, { foo } = {}) => {
params: (resolver, { foo }) => {
if (typeof foo === 'string') {
return resolver.ok({ foo });
}
Expand All @@ -36,7 +36,7 @@ describe('Router validator', () => {
expect(() => validator.getParams({})).toThrowError('[foo]: Not a string');

expect(() => validator.getParams(undefined)).toThrowError(
`Cannot read property 'foo' of undefined`
"Cannot destructure property `foo` of 'undefined' or 'null'."
);
expect(() => validator.getParams({}, 'myField')).toThrowError('[myField.foo]: Not a string');

Expand Down

0 comments on commit e394259

Please sign in to comment.