Skip to content

Commit

Permalink
chore(deps): update dependency fast-check to v2
Browse files Browse the repository at this point in the history
  • Loading branch information
renovate-bot authored and ClementParis016 committed Aug 5, 2021
1 parent b67e635 commit d3a3f0a
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 28 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"eslint": "^7.32.0",
"eslint-config-prettier": "^8.0.0",
"eslint-plugin-jest": "^24.0.0",
"fast-check": "^1.12.0",
"fast-check": "^2.0.0",
"jest": "^27.0.6",
"jest-diff": "^27.0.6",
"jest-junit": "^12.2.0",
Expand Down
1 change: 0 additions & 1 deletion src/__tests__/__setup.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import * as _fc from 'fast-check';
import * as arbitraries from './utils/arbitraries';
import { toBeIdenticalToMonetaryValue } from './utils/matchers';
// eslint-disable-next-line @typescript-eslint/no-unused-vars
import { MonetaryValue } from '../monetary-value';

const _fcplus = Object.assign({}, _fc, arbitraries);
Expand Down
12 changes: 6 additions & 6 deletions src/__tests__/utils/arbitraries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ export function number(

export function unsafeInteger(): Arbitrary<number> {
return oneof(
integer(-Number.MAX_VALUE, Number.MIN_SAFE_INTEGER - 1),
integer(Number.MAX_SAFE_INTEGER + 2, Number.MAX_VALUE),
double(-Number.MAX_VALUE, Number.MIN_SAFE_INTEGER - 1),
double(Number.MAX_SAFE_INTEGER + 2, Number.MAX_VALUE),
);
}

Expand Down Expand Up @@ -68,7 +68,7 @@ export function currency(options: CurrencyOptions = {}): Arbitrary<string> {
'Max length of currency arbitrary is not an integer or not greater than or equal to 1',
);
}
return unicodeString(1, maxLength);
return unicodeString({ minLength: 1, maxLength });
}

// Limiting to 15 because 10 ** 16 > Number.MAX_SAFE_INTEGER
Expand All @@ -79,8 +79,8 @@ export function precision(max = 15): Arbitrary<number> {
export function invalidPrecision(): Arbitrary<number> {
return oneof(
double().filter((n) => !Number.isInteger(n)),
integer(-Number.MAX_VALUE, -1),
integer(16, Number.MAX_VALUE),
double(-Number.MAX_VALUE, -1),
double(16, Number.MAX_VALUE),
oneof(constant(NaN), constant(-Infinity), constant(Infinity)),
);
}
Expand Down Expand Up @@ -219,5 +219,5 @@ function first<T>(array: T[]): T {
}

function element<T>(array: T[]): Arbitrary<T> {
return subarray(array, 1, 1).map(first);
return subarray(array, { minLength: 1, maxLength: 1 }).map(first);
}
4 changes: 2 additions & 2 deletions src/utils/__tests__/assertions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ describe('assertStrictlyPositiveSafeInteger()', () => {
describe('assertValidPrecision()', () => {
it('throws a RangeError when the precision is a positive integer greater than 15', () => {
fc.assert(
fc.property(fc.integer(16, Number.MAX_VALUE), (precision) => {
fc.property(fc.double(16, Number.MAX_VALUE), (precision) => {
expect(() => assertValidPrecision(precision)).toThrow(RangeError);
}),
);
Expand All @@ -122,7 +122,7 @@ describe('assertValidMonetaryValue()', () => {
});
it('throws a RangeError when the precision is a positive integer greater than 15', () => {
fc.assert(
fc.property(fc.integer(16, Number.MAX_VALUE), (precision) => {
fc.property(fc.double(16, Number.MAX_VALUE), (precision) => {
const mv = {
amount: 314,
currency: 'EUR',
Expand Down
28 changes: 10 additions & 18 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2895,13 +2895,12 @@ extsprintf@^1.2.0:
resolved "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.4.0.tgz#e2689f8f356fad62cca65a3a91c5df5f9551692f"
integrity sha1-4mifjzVvrWLMplo6kcXfX5VRaS8=

fast-check@^1.12.0:
version "1.12.0"
resolved "https://registry.yarnpkg.com/fast-check/-/fast-check-1.12.0.tgz#bff7908aa357703f207ee1877ffcf4486a698aa0"
integrity sha512-r/zmvxG/8IsxyOzf9T6wnjJQjSLmymAETeRVfs4/0VzxBmyK48o871BRKmEIgEBLmrg9klh3e4A4BZc3yrH2QQ==
fast-check@^2.0.0:
version "2.17.0"
resolved "https://registry.yarnpkg.com/fast-check/-/fast-check-2.17.0.tgz#9b9637684332be386219a5f73a4799874da7461c"
integrity sha512-fNNKkxNEJP+27QMcEzF6nbpOYoSZIS0p+TyB+xh/jXqRBxRhLkiZSREly4ruyV8uJi7nwH1YWAhi7OOK5TubRw==
dependencies:
lorem-ipsum "~1.0.6"
pure-rand "^1.6.2"
pure-rand "^5.0.0"

fast-deep-equal@^3.1.1, fast-deep-equal@^3.1.3:
version "3.1.3"
Expand Down Expand Up @@ -4590,13 +4589,6 @@ lodash@^4.17.10, lodash@^4.17.4, lodash@^4.2.1, lodash@~4.17.5:
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.11.tgz#b39ea6229ef607ecd89e2c8df12536891cac9b8d"
integrity sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==

lorem-ipsum@~1.0.6:
version "1.0.6"
resolved "https://registry.yarnpkg.com/lorem-ipsum/-/lorem-ipsum-1.0.6.tgz#69e9ab02bbb0991915d71b5559fe016d526f013f"
integrity sha512-Rx4XH8X4KSDCKAVvWGYlhAfNqdUP5ZdT4rRyf0jjrvWgtViZimDIlopWNfn/y3lGM5K4uuiAoY28TaD+7YKFrQ==
dependencies:
minimist "~1.2.0"

loud-rejection@^1.0.0:
version "1.6.0"
resolved "https://registry.yarnpkg.com/loud-rejection/-/loud-rejection-1.6.0.tgz#5b46f80147edee578870f086d04821cf998e551f"
Expand Down Expand Up @@ -4793,7 +4785,7 @@ minimist-options@^3.0.1:
arrify "^1.0.1"
is-plain-obj "^1.1.0"

minimist@^1.1.3, minimist@^1.2.0, minimist@~1.2.0:
minimist@^1.1.3, minimist@^1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284"
integrity sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=
Expand Down Expand Up @@ -5635,10 +5627,10 @@ punycode@^2.1.0, punycode@^2.1.1:
resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec"
integrity sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==

pure-rand@^1.6.2:
version "1.6.2"
resolved "https://registry.yarnpkg.com/pure-rand/-/pure-rand-1.6.2.tgz#90b3ae78efe36f7e6e27bfffedf934f77382e6e6"
integrity sha512-HNwHOH63m7kCxe0kWEe5jSLwJiL2N83RUUN8POniFuZS+OsbFcMWlvXgxIU2nwKy2zYG2bQan40WBNK4biYPRg==
pure-rand@^5.0.0:
version "5.0.0"
resolved "https://registry.yarnpkg.com/pure-rand/-/pure-rand-5.0.0.tgz#87f5bdabeadbd8904e316913a5c0b8caac517b37"
integrity sha512-lD2/y78q+7HqBx2SaT6OT4UcwtvXNRfEpzYEzl0EQ+9gZq2Qi3fa0HDnYPeqQwhlHJFBUhT7AO3mLU3+8bynHA==

q@^1.5.1:
version "1.5.1"
Expand Down

0 comments on commit d3a3f0a

Please sign in to comment.