-
-
Notifications
You must be signed in to change notification settings - Fork 3
Description
I'm using Factoria to generate fixtured for some integration tests.
I'm using MongoDb and sometimes I need knowledge of what an Object's '_id' will be before it's created.
Passing overrides to a Model like in the examples below returns an Object that cannot be written directly to MongoDb because Deepmerge.all clones 'every property from all types of objects'.
`
Factory.define("User", (faker) => ({
_id: new ObjectId(),
firstname: faker.name.firstName(),
lastname: faker.name.lastName(),
email: faker.internet.email(),
timezone: faker.address.timeZone(),
}))
const user_id = new ObjectId();
const user = Factory("User", 1, { _id: user_id });
`
Can we modify the deepmerge.all on line 52 of index.ts to accept options that implements isMergeableObject and only clones properties from non-instantiated objects?
{ isMergeableObject: isPlainObject }