sequelize-fixtures icon indicating copy to clipboard operation
sequelize-fixtures copied to clipboard

Support writing references to the fixtures

Open holm opened this issue 8 years ago • 1 comments

This is a work-in-progress, and was mostly to see if there is any interest in this.

It supports giving a fixture a name, and writing out the primary key of the instance after it has been inserted. This is very convenient for unit tests, since you can reference the fixture by name rather than directly by id.

holm avatar Dec 18 '17 12:12 holm

@holm, I just ran into a failing test that was caused by another test accidentally modifying an object inside the value exported from the reference file. I think it would make sense to do a deep Object.freeze on the value to prevent that. In strict mode that would cause attempted mutations to throw a TypeError, which would help with tracking down the offending test.

Let me know if think it's a good idea, then I'll take a stab at it :)

papandreou avatar Dec 21 '17 12:12 papandreou