From bc5a242a73e70fff43abad109310cdd5ee93ab8e Mon Sep 17 00:00:00 2001 From: Shinigami92 Date: Tue, 8 Nov 2022 22:32:58 +0100 Subject: [PATCH] test: add missing tests --- test/date.spec.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/test/date.spec.ts b/test/date.spec.ts index 958cc3bdad1..365e2cab7f5 100644 --- a/test/date.spec.ts +++ b/test/date.spec.ts @@ -218,6 +218,13 @@ describe('date', () => { expect(date).lessThanOrEqual(new Date()); }); + it('should throw an error when days = 0', () => { + const refDate = new Date(); + expect(() => faker.date.recent(0, refDate.toISOString())).toThrow( + new FakerError('Days must be greater than 0.') + ); + }); + it.each(converterMap)( 'should return a date N days from the recent past, starting from refDate', (converter) => { @@ -249,6 +256,13 @@ describe('date', () => { expect(date).greaterThanOrEqual(new Date()); }); + it('should throw an error when days = 0', () => { + const refDate = new Date(); + expect(() => faker.date.soon(0, refDate.toISOString())).toThrow( + new FakerError('Days must be greater than 0.') + ); + }); + it.each(converterMap)( 'should return a date N days from the recent future, starting from refDate', (converter) => {