Skip to content

Commit

Permalink
Fix dat test
Browse files Browse the repository at this point in the history
  • Loading branch information
KonstantinSimeonov committed Jul 25, 2018
1 parent 6b72766 commit 30f2e1e
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions test/tests/union.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,17 @@ test('.validate() returns errors when the values satisfies the conditions of no
const shortStrings = ['js', '', new String('1')];
const floats = [1.5, -0.5, new Number(2.5)];

shouldReturnErrors(assert, schema, shortStrings, { type: ERROR_TYPES.RANGE });
shouldReturnErrors(assert, schema, floats, { type: ERROR_TYPES.ARGUMENT });
shortStrings.concat(floats)
.map(v => schema.validate(v))
.forEach(({ errors, errorsCount }) => {
assert.is(errorsCount, 2);

assert.not(
errors.find(e => e.type === ERROR_TYPES.TYPE), undefined
);

assert.not(
errors.find(e => [ERROR_TYPES.ARGUMENT, ERROR_TYPES.RANGE].includes(e.type)), undefined
);
});
});

0 comments on commit 30f2e1e

Please sign in to comment.