Skip to content

Commit

Permalink
refactor(helpers): remove default value from arrayElements
Browse files Browse the repository at this point in the history
  • Loading branch information
xDivisionByZerox committed Apr 13, 2023
1 parent 80e2d59 commit 99c16e4
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 26 deletions.
4 changes: 1 addition & 3 deletions src/modules/helpers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -883,9 +883,7 @@ export class HelpersModule {
* @since 6.3.0
*/
arrayElements<T>(
// TODO @Shinigami92 2022-04-30: We want to remove this default value, but currently it's not possible because some definitions could be empty
// See https://github.com/faker-js/faker/issues/893
array: ReadonlyArray<T> = ['a', 'b', 'c'] as unknown as ReadonlyArray<T>,
array: ReadonlyArray<T>,
count?:
| number
| {
Expand Down
21 changes: 0 additions & 21 deletions test/__snapshots__/helpers.spec.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,6 @@

exports[`helpers > 42 > arrayElement > with array 1`] = `"o"`;

exports[`helpers > 42 > arrayElements > noArgs 1`] = `
[
"b",
"c",
]
`;

exports[`helpers > 42 > arrayElements > with array 1`] = `
[
"r",
Expand Down Expand Up @@ -226,14 +219,6 @@ exports[`helpers > 42 > weightedArrayElement > with array with percentages 1`] =

exports[`helpers > 1211 > arrayElement > with array 1`] = `"!"`;

exports[`helpers > 1211 > arrayElements > noArgs 1`] = `
[
"a",
"c",
"b",
]
`;

exports[`helpers > 1211 > arrayElements > with array 1`] = `
[
"d",
Expand Down Expand Up @@ -467,12 +452,6 @@ exports[`helpers > 1211 > weightedArrayElement > with array with percentages 1`]

exports[`helpers > 1337 > arrayElement > with array 1`] = `"l"`;

exports[`helpers > 1337 > arrayElements > noArgs 1`] = `
[
"b",
]
`;

exports[`helpers > 1337 > arrayElements > with array 1`] = `
[
"l",
Expand Down
3 changes: 1 addition & 2 deletions test/helpers.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,7 @@ describe('helpers', () => {
});

t.describe('arrayElements', (t) => {
t.it('noArgs')
.it('with array', 'Hello World!'.split(''))
t.it('with array', 'Hello World!'.split(''))
.it('with array and count', 'Hello World!'.split(''), 3)
.it('with array and count range', 'Hello World!'.split(''), {
min: 1,
Expand Down

0 comments on commit 99c16e4

Please sign in to comment.