aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShinigami <[email protected]>2022-12-17 19:59:25 +0100
committerGitHub <[email protected]>2022-12-17 19:59:25 +0100
commit0b2fa1ae96c6aabb7bcaae8d7f5f90df86d43786 (patch)
treede18ddcb77c383a761e370067c259e70f976bd60
parentb7dbfaca9790b23210a56615d56913b0acccb24c (diff)
downloadfaker-0b2fa1ae96c6aabb7bcaae8d7f5f90df86d43786.tar.xz
faker-0b2fa1ae96c6aabb7bcaae8d7f5f90df86d43786.zip
feat(number)!: change int default params (#1643)
-rw-r--r--src/modules/number/index.ts4
-rw-r--r--test/__snapshots__/datatype.spec.ts.snap56
-rw-r--r--test/__snapshots__/helpers.spec.ts.snap6
-rw-r--r--test/__snapshots__/image.spec.ts.snap52
-rw-r--r--test/__snapshots__/number.spec.ts.snap6
5 files changed, 62 insertions, 62 deletions
diff --git a/src/modules/number/index.ts b/src/modules/number/index.ts
index 62036ab1..d3f27453 100644
--- a/src/modules/number/index.ts
+++ b/src/modules/number/index.ts
@@ -22,7 +22,7 @@ export class NumberModule {
*
* @param options Maximum value or options object. Defaults to `{}`.
* @param options.min Lower bound for generated number. Defaults to `0`.
- * @param options.max Upper bound for generated number. Defaults to `min + 99999`.
+ * @param options.max Upper bound for generated number. Defaults to `Number.MAX_SAFE_INTEGER`.
*
* @throws When options define `max < min`.
*
@@ -42,7 +42,7 @@ export class NumberModule {
options = { max: options };
}
- const { min = 0, max = min + 99999 } = options;
+ const { min = 0, max = Number.MAX_SAFE_INTEGER } = options;
const effectiveMin = Math.ceil(min);
const effectiveMax = Math.floor(max);
diff --git a/test/__snapshots__/datatype.spec.ts.snap b/test/__snapshots__/datatype.spec.ts.snap
index 0a070497..b4dae898 100644
--- a/test/__snapshots__/datatype.spec.ts.snap
+++ b/test/__snapshots__/datatype.spec.ts.snap
@@ -4,13 +4,13 @@ exports[`datatype > 42 > array > noArgs 1`] = `
[
"ky2eiXX/J/",
- 72199,
- 93855,
+ 6503186795855872,
+ 8453731307749376,
"!1}2Z=YQ!I",
"<QYF-%<{C6",
")jZ3DP|XL%",
- 60754,
- 17052,
+ 5472277529362432,
+ 1535944771502080,
"'\\"yxzUlD=\\"",
]
`;
@@ -19,17 +19,17 @@ exports[`datatype > 42 > array > with length 1`] = `
[
"ky2eiXX/J/",
- 72199,
- 93855,
+ 6503186795855872,
+ 8453731307749376,
]
`;
exports[`datatype > 42 > array > with length range 1`] = `
[
- 95071,
+ 8563273238577152,
"eiXX/J/*&K",
- 33370,
- 14286,
+ 3005779955154944,
+ 1286829863075840,
]
`;
@@ -93,7 +93,7 @@ exports[`datatype > 42 > hexadecimal > with length, prefix, and casing 1`] = `"0
exports[`datatype > 42 > hexadecimal > with prefix 1`] = `"0x8"`;
-exports[`datatype > 42 > json 1`] = `"{\\"foo\\":\\"ky2eiXX/J/\\",\\"bar\\":\\"&[email protected]]\\\\\\"&\\",\\"bike\\":72199,\\"a\\":93855,\\"b\\":\\"!1}2Z=YQ!I\\",\\"name\\":\\"<QYF-%<{C6\\",\\"prop\\":\\")jZ3DP|XL%\\"}"`;
+exports[`datatype > 42 > json 1`] = `"{\\"foo\\":\\"ky2eiXX/J/\\",\\"bar\\":\\"&[email protected]]\\\\\\"&\\",\\"bike\\":6503186795855872,\\"a\\":8453731307749376,\\"b\\":\\"!1}2Z=YQ!I\\",\\"name\\":\\"<QYF-%<{C6\\",\\"prop\\":\\")jZ3DP|XL%\\"}"`;
exports[`datatype > 42 > number > noArgs 1`] = `37454`;
@@ -131,14 +131,14 @@ exports[`datatype > 42 > uuid 5`] = `"d95f4984-24c2-410f-ac63-400d3bbbcc91"`;
exports[`datatype > 1211 > array > noArgs 1`] = `
[
- 45901,
- 77826,
+ 4134441414819840,
+ 7010029022478336,
"-}$_/\`4hHA",
"afl\\"h^]dnw",
"<q|p|5KWu3",
"CZ|Jh!E=x\\"",
- 42131,
- 15894,
+ 3794869965291520,
+ 1431627091673088,
"V<1bEQuA|p",
"DW9F=V1(U7",
]
@@ -146,8 +146,8 @@ exports[`datatype > 1211 > array > noArgs 1`] = `
exports[`datatype > 1211 > array > with length 1`] = `
[
- 45901,
- 77826,
+ 4134441414819840,
+ 7010029022478336,
"-}$_/\`4hHA",
"afl\\"h^]dnw",
]
@@ -156,9 +156,9 @@ exports[`datatype > 1211 > array > with length 1`] = `
exports[`datatype > 1211 > array > with length range 1`] = `
[
"ti5-}$_/\`4",
- 42075,
+ 3789861976801280,
"0afl\\"h^]dn",
- 43503,
+ 3918465303838720,
"q|p|5KWu3/",
]
`;
@@ -223,7 +223,7 @@ exports[`datatype > 1211 > hexadecimal > with length, prefix, and casing 1`] = `
exports[`datatype > 1211 > hexadecimal > with prefix 1`] = `"0xE"`;
-exports[`datatype > 1211 > json 1`] = `"{\\"foo\\":45901,\\"bar\\":77826,\\"bike\\":\\"-}$_/\`4hHA\\",\\"a\\":\\"afl\\\\\\"h^]dnw\\",\\"b\\":\\"<q|p|5KWu3\\",\\"name\\":\\"CZ|Jh!E=x\\\\\\"\\",\\"prop\\":42131}"`;
+exports[`datatype > 1211 > json 1`] = `"{\\"foo\\":4134441414819840,\\"bar\\":7010029022478336,\\"bike\\":\\"-}$_/\`4hHA\\",\\"a\\":\\"afl\\\\\\"h^]dnw\\",\\"b\\":\\"<q|p|5KWu3\\",\\"name\\":\\"CZ|Jh!E=x\\\\\\"\\",\\"prop\\":3794869965291520}"`;
exports[`datatype > 1211 > number > noArgs 1`] = `92852`;
@@ -262,22 +262,22 @@ exports[`datatype > 1211 > uuid 5`] = `"7b91ce88-effb-4d1d-93bb-ad759e00b86c"`;
exports[`datatype > 1337 > array > noArgs 1`] = `
[
"U/4:SK$>6Q",
- 26194,
+ 2359372120326144,
"{:e=+kD)[B",
"e|/Jqjjj!B",
"GDWQgC2M;q",
- 40502,
- 44050,
+ 3648103756333056,
+ 3967686428065792,
".Gm3tRwnZ2",
- 95735,
- 42541,
+ 8623125245722624,
+ 3831794621218816,
]
`;
exports[`datatype > 1337 > array > with length 1`] = `
[
"U/4:SK$>6Q",
- 26194,
+ 2359372120326144,
"{:e=+kD)[B",
"e|/Jqjjj!B",
]
@@ -285,9 +285,9 @@ exports[`datatype > 1337 > array > with length 1`] = `
exports[`datatype > 1337 > array > with length range 1`] = `
[
- 15868,
+ 1429298200182784,
":SK$>6QX9@",
- 27048,
+ 2436284417048576,
]
`;
@@ -351,7 +351,7 @@ exports[`datatype > 1337 > hexadecimal > with length, prefix, and casing 1`] = `
exports[`datatype > 1337 > hexadecimal > with prefix 1`] = `"0x5"`;
-exports[`datatype > 1337 > json 1`] = `"{\\"foo\\":\\"U/4:SK$>6Q\\",\\"bar\\":26194,\\"bike\\":\\"{:e=+kD)[B\\",\\"a\\":\\"e|/Jqjjj!B\\",\\"b\\":\\"GDWQgC2M;q\\",\\"name\\":40502,\\"prop\\":44050}"`;
+exports[`datatype > 1337 > json 1`] = `"{\\"foo\\":\\"U/4:SK$>6Q\\",\\"bar\\":2359372120326144,\\"bike\\":\\"{:e=+kD)[B\\",\\"a\\":\\"e|/Jqjjj!B\\",\\"b\\":\\"GDWQgC2M;q\\",\\"name\\":3648103756333056,\\"prop\\":3967686428065792}"`;
exports[`datatype > 1337 > number > noArgs 1`] = `26202`;
diff --git a/test/__snapshots__/helpers.spec.ts.snap b/test/__snapshots__/helpers.spec.ts.snap
index 68fba3bc..ec47923b 100644
--- a/test/__snapshots__/helpers.spec.ts.snap
+++ b/test/__snapshots__/helpers.spec.ts.snap
@@ -155,7 +155,7 @@ exports[`helpers > 42 > slugify > noArgs 1`] = `""`;
exports[`helpers > 42 > slugify > some string 1`] = `"hello-world"`;
-exports[`helpers > 42 > unique > with () => number 1`] = `37454`;
+exports[`helpers > 42 > unique > with () => number 1`] = `3373557438480384`;
exports[`helpers > 42 > unique > with () => number and args 1`] = `19`;
@@ -340,7 +340,7 @@ exports[`helpers > 1211 > slugify > noArgs 1`] = `""`;
exports[`helpers > 1211 > slugify > some string 1`] = `"hello-world"`;
-exports[`helpers > 1211 > unique > with () => number 1`] = `92852`;
+exports[`helpers > 1211 > unique > with () => number 1`] = `8363366036799488`;
exports[`helpers > 1211 > unique > with () => number and args 1`] = `47`;
@@ -508,7 +508,7 @@ exports[`helpers > 1337 > slugify > noArgs 1`] = `""`;
exports[`helpers > 1337 > slugify > some string 1`] = `"hello-world"`;
-exports[`helpers > 1337 > unique > with () => number 1`] = `26202`;
+exports[`helpers > 1337 > unique > with () => number 1`] = `2360108468142080`;
exports[`helpers > 1337 > unique > with () => number and args 1`] = `13`;
diff --git a/test/__snapshots__/image.spec.ts.snap b/test/__snapshots__/image.spec.ts.snap
index 61a4d245..f42ac02f 100644
--- a/test/__snapshots__/image.spec.ts.snap
+++ b/test/__snapshots__/image.spec.ts.snap
@@ -6,25 +6,25 @@ exports[`image > 42 > avatarGitHub 1`] = `"https://avatars.githubusercontent.com
exports[`image > 42 > avatarLegacy 1`] = `"https://cloudflare-ipfs.com/ipfs/Qmd3W5DuhgHirLHGVixi6V76LhCkZUz6pnFt5AJBiyvHye/avatar/468.jpg"`;
-exports[`image > 42 > url > noArgs 1`] = `"https://loremflickr.com/640/480?lock=79654"`;
+exports[`image > 42 > url > noArgs 1`] = `"https://loremflickr.com/640/480?lock=7174621373661184"`;
-exports[`image > 42 > url > with height 1`] = `"https://loremflickr.com/640/128?lock=79654"`;
+exports[`image > 42 > url > with height 1`] = `"https://loremflickr.com/640/128?lock=7174621373661184"`;
-exports[`image > 42 > url > with width 1`] = `"https://loremflickr.com/128/480?lock=79654"`;
+exports[`image > 42 > url > with width 1`] = `"https://loremflickr.com/128/480?lock=7174621373661184"`;
-exports[`image > 42 > url > with width and height 1`] = `"https://loremflickr.com/128/128?lock=79654"`;
+exports[`image > 42 > url > with width and height 1`] = `"https://loremflickr.com/128/128?lock=7174621373661184"`;
-exports[`image > 42 > urlLoremFlickr > noArgs 1`] = `"https://loremflickr.com/640/480?lock=37454"`;
+exports[`image > 42 > urlLoremFlickr > noArgs 1`] = `"https://loremflickr.com/640/480?lock=3373557438480384"`;
-exports[`image > 42 > urlLoremFlickr > with all options 1`] = `"https://loremflickr.com/128/128/cats?lock=37454"`;
+exports[`image > 42 > urlLoremFlickr > with all options 1`] = `"https://loremflickr.com/128/128/cats?lock=3373557438480384"`;
-exports[`image > 42 > urlLoremFlickr > with category 1`] = `"https://loremflickr.com/640/480/cats?lock=37454"`;
+exports[`image > 42 > urlLoremFlickr > with category 1`] = `"https://loremflickr.com/640/480/cats?lock=3373557438480384"`;
-exports[`image > 42 > urlLoremFlickr > with height 1`] = `"https://loremflickr.com/640/128?lock=37454"`;
+exports[`image > 42 > urlLoremFlickr > with height 1`] = `"https://loremflickr.com/640/128?lock=3373557438480384"`;
-exports[`image > 42 > urlLoremFlickr > with width 1`] = `"https://loremflickr.com/128/480?lock=37454"`;
+exports[`image > 42 > urlLoremFlickr > with width 1`] = `"https://loremflickr.com/128/480?lock=3373557438480384"`;
-exports[`image > 42 > urlLoremFlickr > with width and height 1`] = `"https://loremflickr.com/128/128?lock=37454"`;
+exports[`image > 42 > urlLoremFlickr > with width and height 1`] = `"https://loremflickr.com/128/128?lock=3373557438480384"`;
exports[`image > 42 > urlPicsumPhotos > noArgs 1`] = `"https://picsum.photos/id/374/640/480"`;
@@ -74,17 +74,17 @@ exports[`image > 1211 > url > with width 1`] = `"https://picsum.photos/id/459/12
exports[`image > 1211 > url > with width and height 1`] = `"https://picsum.photos/id/459/128/128"`;
-exports[`image > 1211 > urlLoremFlickr > noArgs 1`] = `"https://loremflickr.com/640/480?lock=92852"`;
+exports[`image > 1211 > urlLoremFlickr > noArgs 1`] = `"https://loremflickr.com/640/480?lock=8363366036799488"`;
-exports[`image > 1211 > urlLoremFlickr > with all options 1`] = `"https://loremflickr.com/128/128/cats?lock=92852"`;
+exports[`image > 1211 > urlLoremFlickr > with all options 1`] = `"https://loremflickr.com/128/128/cats?lock=8363366036799488"`;
-exports[`image > 1211 > urlLoremFlickr > with category 1`] = `"https://loremflickr.com/640/480/cats?lock=92852"`;
+exports[`image > 1211 > urlLoremFlickr > with category 1`] = `"https://loremflickr.com/640/480/cats?lock=8363366036799488"`;
-exports[`image > 1211 > urlLoremFlickr > with height 1`] = `"https://loremflickr.com/640/128?lock=92852"`;
+exports[`image > 1211 > urlLoremFlickr > with height 1`] = `"https://loremflickr.com/640/128?lock=8363366036799488"`;
-exports[`image > 1211 > urlLoremFlickr > with width 1`] = `"https://loremflickr.com/128/480?lock=92852"`;
+exports[`image > 1211 > urlLoremFlickr > with width 1`] = `"https://loremflickr.com/128/480?lock=8363366036799488"`;
-exports[`image > 1211 > urlLoremFlickr > with width and height 1`] = `"https://loremflickr.com/128/128?lock=92852"`;
+exports[`image > 1211 > urlLoremFlickr > with width and height 1`] = `"https://loremflickr.com/128/128?lock=8363366036799488"`;
exports[`image > 1211 > urlPicsumPhotos > noArgs 1`] = `"https://picsum.photos/id/929/640/480"`;
@@ -126,25 +126,25 @@ exports[`image > 1337 > avatarGitHub 1`] = `"https://avatars.githubusercontent.c
exports[`image > 1337 > avatarLegacy 1`] = `"https://cloudflare-ipfs.com/ipfs/Qmd3W5DuhgHirLHGVixi6V76LhCkZUz6pnFt5AJBiyvHye/avatar/327.jpg"`;
-exports[`image > 1337 > url > noArgs 1`] = `"https://loremflickr.com/640/480?lock=56052"`;
+exports[`image > 1337 > url > noArgs 1`] = `"https://loremflickr.com/640/480?lock=5048803172286464"`;
-exports[`image > 1337 > url > with height 1`] = `"https://loremflickr.com/640/128?lock=56052"`;
+exports[`image > 1337 > url > with height 1`] = `"https://loremflickr.com/640/128?lock=5048803172286464"`;
-exports[`image > 1337 > url > with width 1`] = `"https://loremflickr.com/128/480?lock=56052"`;
+exports[`image > 1337 > url > with width 1`] = `"https://loremflickr.com/128/480?lock=5048803172286464"`;
-exports[`image > 1337 > url > with width and height 1`] = `"https://loremflickr.com/128/128?lock=56052"`;
+exports[`image > 1337 > url > with width and height 1`] = `"https://loremflickr.com/128/128?lock=5048803172286464"`;
-exports[`image > 1337 > urlLoremFlickr > noArgs 1`] = `"https://loremflickr.com/640/480?lock=26202"`;
+exports[`image > 1337 > urlLoremFlickr > noArgs 1`] = `"https://loremflickr.com/640/480?lock=2360108468142080"`;
-exports[`image > 1337 > urlLoremFlickr > with all options 1`] = `"https://loremflickr.com/128/128/cats?lock=26202"`;
+exports[`image > 1337 > urlLoremFlickr > with all options 1`] = `"https://loremflickr.com/128/128/cats?lock=2360108468142080"`;
-exports[`image > 1337 > urlLoremFlickr > with category 1`] = `"https://loremflickr.com/640/480/cats?lock=26202"`;
+exports[`image > 1337 > urlLoremFlickr > with category 1`] = `"https://loremflickr.com/640/480/cats?lock=2360108468142080"`;
-exports[`image > 1337 > urlLoremFlickr > with height 1`] = `"https://loremflickr.com/640/128?lock=26202"`;
+exports[`image > 1337 > urlLoremFlickr > with height 1`] = `"https://loremflickr.com/640/128?lock=2360108468142080"`;
-exports[`image > 1337 > urlLoremFlickr > with width 1`] = `"https://loremflickr.com/128/480?lock=26202"`;
+exports[`image > 1337 > urlLoremFlickr > with width 1`] = `"https://loremflickr.com/128/480?lock=2360108468142080"`;
-exports[`image > 1337 > urlLoremFlickr > with width and height 1`] = `"https://loremflickr.com/128/128?lock=26202"`;
+exports[`image > 1337 > urlLoremFlickr > with width and height 1`] = `"https://loremflickr.com/128/128?lock=2360108468142080"`;
exports[`image > 1337 > urlPicsumPhotos > noArgs 1`] = `"https://picsum.photos/id/262/640/480"`;
diff --git a/test/__snapshots__/number.spec.ts.snap b/test/__snapshots__/number.spec.ts.snap
index 91295faa..29605f55 100644
--- a/test/__snapshots__/number.spec.ts.snap
+++ b/test/__snapshots__/number.spec.ts.snap
@@ -30,7 +30,7 @@ exports[`number > 42 > hex > with options 1`] = `"4"`;
exports[`number > 42 > hex > with value 1`] = `"0"`;
-exports[`number > 42 > int > noArgs 1`] = `37454`;
+exports[`number > 42 > int > noArgs 1`] = `3373557438480384`;
exports[`number > 42 > int > with options 1`] = `4`;
@@ -66,7 +66,7 @@ exports[`number > 1211 > hex > with options 1`] = `"a"`;
exports[`number > 1211 > hex > with value 1`] = `"1"`;
-exports[`number > 1211 > int > noArgs 1`] = `92852`;
+exports[`number > 1211 > int > noArgs 1`] = `8363366036799488`;
exports[`number > 1211 > int > with options 1`] = `10`;
@@ -102,7 +102,7 @@ exports[`number > 1337 > hex > with options 1`] = `"2"`;
exports[`number > 1337 > hex > with value 1`] = `"0"`;
-exports[`number > 1337 > int > noArgs 1`] = `26202`;
+exports[`number > 1337 > int > noArgs 1`] = `2360108468142080`;
exports[`number > 1337 > int > with options 1`] = `2`;