node-mongoose-fixtures
node-mongoose-fixtures copied to clipboard
Upgrading from 0.2.4 to 0.3.0
My tests broke when I upgraded from 0.2.4 to 0.3.0.
An example scenario:
fixtures.save('mockAccount', {
account: {
username: 'one', password: 'pass'
}
});
fixtures('mockAccount', function(err, data) {
});
In 0.2.4, data
looked like
[
{
username: "one",
password: "pass"
}
]
In 0.3.0, data
looks like
[
[
{
username: "one",
password: "pass"
}
]
]
Looks like it is caused from a change in lib/index.js
line 28: create
was changed to insertMany
.
Is this expected?
Just looking into this a bit more, in lib/index.js
line 29 the arguments
index contains the result of the insert.
For create
, a single item fixture such as the one I'm using above will return an object as the result. However with insertMany
it will return an array.
Is there any chance we can keep the previous behaviour for single item fixtures?