Skip to content

Commit

Permalink
Add test for #2666
Browse files Browse the repository at this point in the history
  • Loading branch information
hueniverse committed Dec 1, 2021
1 parent f732265 commit 4bfb9d4
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion test/types/number.js
Original file line number Diff line number Diff line change
Expand Up @@ -714,7 +714,7 @@ describe('number', () => {

const schema = Joi.number().multiple(3.5);
Helper.validate(schema, [
[0, true], // 0 is a multiple of every integer
[0, true], // 0 is a multiple of every number
[3.5, true],
[3.6, false, {
message: '"value" must be a multiple of 3.5',
Expand Down Expand Up @@ -744,6 +744,17 @@ describe('number', () => {
]);
});

it('handles 0.1 multiples', () => {

const schema = Joi.number().multiple(0.1);
Helper.validate(schema, [
[0, true], // 0 is a multiple of every number
[3.5, true],
[100.1, true],
[3.61, false, '"value" must be a multiple of 0.1']
]);
});

it('handles references correctly', () => {

const ref = Joi.ref('a');
Expand Down

0 comments on commit 4bfb9d4

Please sign in to comment.