Skip to content

Commit

Permalink
feat(date-options): enabled passing options through to change.date()
Browse files Browse the repository at this point in the history
Co-authored-by: Julie Van Kirk <VanKirkJulieA@JohnDeere.com>
Co-authored-by: May Liang <LiangMay@JohnDeere.com>
  • Loading branch information
3 people committed Feb 6, 2024
1 parent f496553 commit eb0cf85
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export const paragraph = options => chance.paragraph(!isPrimitive(options) ? opt
export const url = options => chance.url(!isPrimitive(options) ? options : undefined);
export const boolean = options => chance.bool(!isPrimitive(options) ? options : undefined);
export const email = options => chance.email(!isPrimitive(options) ? options : undefined);
export const date = () => chance.date({string: true});
export const date = options => chance.date({string: true, ...options});
export const fromList = list => chance.pickone(list);
export const subList = (list, {size}) => chance.pickset(list, size);

Expand Down
7 changes: 7 additions & 0 deletions test/unit/base-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,13 @@ suite('base generators', () => {
const date = chance.date();
chanceStub.date.withArgs({string: true}).returns(date);

assert.equal(any.date(), date);
});

test('that options can be passed through the date factory to the chance method', () => {
const date = chance.date();
chanceStub.date.withArgs({string: true, ...options}).returns(date);

assert.equal(any.date(options), date);
});

Expand Down

0 comments on commit eb0cf85

Please sign in to comment.