diff --git a/src/base.js b/src/base.js index 58d522c2..1c9721ff 100644 --- a/src/base.js +++ b/src/base.js @@ -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); diff --git a/test/unit/base-test.js b/test/unit/base-test.js index a8275456..5206e2f5 100644 --- a/test/unit/base-test.js +++ b/test/unit/base-test.js @@ -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); });