Skip to content

Commit

Permalink
Test undefined limit and base
Browse files Browse the repository at this point in the history
  • Loading branch information
trizotti committed Oct 7, 2022
1 parent 8d34551 commit 6e89706
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions test/types/number.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,14 @@ describe('number', () => {

describe('greater()', () => {

it('throws when limit is undefined', () => {

expect(() => {

Joi.number().greater();
}).to.throw('limit is required');
});

it('throws when limit is not a number', () => {

expect(() => {
Expand Down Expand Up @@ -245,6 +253,14 @@ describe('number', () => {

describe('less()', () => {

it('throws when limit is undefined', () => {

expect(() => {

Joi.number().less();
}).to.throw('limit is required');
});

it('throws when limit is not a number', () => {

expect(() => {
Expand Down Expand Up @@ -379,6 +395,14 @@ describe('number', () => {

describe('max()', () => {

it('throws when limit is undefined', () => {

expect(() => {

Joi.number().max();
}).to.throw('limit is required');
});

it('throws when limit is not a number', () => {

expect(() => {
Expand Down Expand Up @@ -498,6 +522,11 @@ describe('number', () => {

describe('min()', () => {

it('throws when limit is undefined', () => {

expect(() => Joi.number().min()).to.throw('limit is required');
});

it('throws when limit is not a number', () => {

expect(() => Joi.number().min('a')).to.throw('limit must be a number or reference');
Expand Down Expand Up @@ -660,6 +689,14 @@ describe('number', () => {

describe('multiple()', () => {

it('throws when base is undefined', () => {

expect(() => {

Joi.number().multiple();
}).to.throw('base is required');
});

it('throws when multiple is not a number', () => {

expect(() => {
Expand Down

0 comments on commit 6e89706

Please sign in to comment.