The biggest reason to use factories instead of fixtures is that the properties are not static, so your tests aren't depending on static "magic" values. This article explains pretty well why thoughtbot's factory_girl gem is better than the built-in rails fixtures.
For this reason, I think this library should support generating dynamic properties.
For example:
chai.factory('person', {
age: () => { Math.floor(Math.random() * (100 - 5)) + 5) } // Pick a random age between 5 and 100.
});
var user1 = chai.create('person');
var user2 = chai.create('person');
console.log(user1.age); // Logs 31
console.log(user2.age); // Logs 57
The biggest reason to use factories instead of fixtures is that the properties are not static, so your tests aren't depending on static "magic" values. This article explains pretty well why thoughtbot's factory_girl gem is better than the built-in rails fixtures.
For this reason, I think this library should support generating dynamic properties.
For example: