Options and Parsers

Some faker methods need additional parameters, you can inject them by using full data model definition (shown below).

{
  fieldName: 'methodYouWantToUse',
}
// is equivalent to
{
  fieldName: {
     method: 'methodYouWantToUse',
  }
}

Options

If given method requires additional parameters you can pass it by adding args property

var userDataModel = {
  age: {
    method: 'random.number',
    args: [
      {
        min: 18,
        max: 90
      }
    ]
  }
};

fixtureFactory.register('user', userDataModel);
fixtureFactory.generateOne();

expect

{
 age: <number between 18 and 90>
}

Passing parser method

you can pass parser method to change modify value of acquired fixture field

var userDataModel = {
  firstName : 'name.firstName'
};

fixtureFactory.register('user', userDataModel);

fixtureFactory.generateOne('user', {
  firstName: function (fixtures, options, dataModel, faker) {
    return 'sir '+ faker.name.firstName();
  }
});

expect

{
 firstName: 'sir <some generated name>'
}