-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
103 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export const config = { | ||
generateRandom: Math.random, | ||
skipValidations: false, | ||
testSampleSize: 15, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,37 @@ | ||
const testSampleSizeKey = Symbol('Test sample size') | ||
const testSampleSize = Symbol('Test sample size') | ||
const skipValidations = Symbol('Skip validations') | ||
const generateRandom = Symbol('Generate random') | ||
|
||
export const config = { | ||
[testSampleSizeKey]: 15, | ||
[generateRandom]: Math.random, | ||
[skipValidations]: false, | ||
[testSampleSize]: 15, | ||
|
||
get generateRandom() { | ||
return this[generateRandom] | ||
}, | ||
|
||
set generateRandom(value: () => number) { | ||
this[generateRandom] = value | ||
}, | ||
|
||
get skipValidations() { | ||
return this[skipValidations] | ||
}, | ||
|
||
set skipValidations(value: boolean) { | ||
this[skipValidations] = !!value | ||
}, | ||
|
||
get testSampleSize() { | ||
return this[testSampleSizeKey] | ||
return this[testSampleSize] | ||
}, | ||
|
||
set testSampleSize(value: number) { | ||
if (value < 0) { | ||
throw new Error(`Test sample size cannot be negative (got ${value}).`) | ||
} | ||
|
||
this[testSampleSizeKey] = Math.trunc(value) | ||
this[testSampleSize] = Math.trunc(value) | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters