Skip to content

Commit 8f2d5c8

Browse files
authored
test(date): add birthdate error test (#1833)
1 parent de0768c commit 8f2d5c8

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

test/date.spec.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -558,6 +558,19 @@ describe('date', () => {
558558
new Date().getUTCFullYear() - min
559559
);
560560
});
561+
562+
it('should throw an error when the min > max year', () => {
563+
const min = 2000;
564+
const max = 1990;
565+
566+
expect(() =>
567+
faker.date.birthdate({ min, max, mode: 'year' })
568+
).toThrow(
569+
new FakerError(
570+
`Max 662515200000 should be larger then min 946771200000.`
571+
)
572+
);
573+
});
561574
});
562575

563576
describe('deprecated', () => {

0 commit comments

Comments
 (0)