aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter <[email protected]>2023-02-14 21:56:32 +0000
committerGitHub <[email protected]>2023-02-14 21:56:32 +0000
commit8f2d5c8a6d5c733e0dde6efdd3a5e058d372ee07 (patch)
treea3a28d5234e0f667fa5293e0e861602c86a65e11
parentde0768c1f072ce7f18f83752864f89a858ff1d68 (diff)
downloadfaker-8f2d5c8a6d5c733e0dde6efdd3a5e058d372ee07.tar.xz
faker-8f2d5c8a6d5c733e0dde6efdd3a5e058d372ee07.zip
test(date): add birthdate error test (#1833)
-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', () => {