API
There is single API endpoint to register and two to generate your fixtures. This is only quick overview, followup
.reqister(key, dataModel);
Registers passed dataModel
under a key
in the fixtureFactoryRegistry
fixtureFactory.register('user', {
name: 'name.firstName',
email: 'internet.email',
});
.generate(key, count, customFields)
Generates array with the length equal to passed count
containing fixtures previously registered dataModel
stored under key
. Pass your own customFields.
fixtureFactory.generate('user', 2, {
admin: true
});
.generate(dataModel, count, customFields)
Same as .generate
but a raw dataModel
is passed instead of a fixture factory registry key
.generateOne
Alias to .generate(sth, 1 sth)
.unregister(key)
Deletes the dataModel
and key
under which it is stored
.reset()
Unregisters all models
.getGenerator(key)
Gets a simple object with .generate(count,customFields)
and .generateOne(customFields)
aliasing to .generate(key, count, customFields)
and .generateOne(key, customFields)
Updated less than a minute ago