aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/date.spec.ts13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/date.spec.ts b/test/date.spec.ts
index a9eaeb73..b0eec16c 100644
--- a/test/date.spec.ts
+++ b/test/date.spec.ts
@@ -558,6 +558,19 @@ describe('date', () => {
new Date().getUTCFullYear() - min
);
});
+
+ it('should throw an error when the min > max year', () => {
+ const min = 2000;
+ const max = 1990;
+
+ expect(() =>
+ faker.date.birthdate({ min, max, mode: 'year' })
+ ).toThrow(
+ new FakerError(
+ `Max 662515200000 should be larger then min 946771200000.`
+ )
+ );
+ });
});
describe('deprecated', () => {