I would like to write a test that verifies that a certain property will be saved using Mongoose, for instance:
var newUser = new userModel({
id: /*something*/,
gu: true
});
newUser.save(function (err, user) {
/* ... */
res.send(user.id);
});
In my tests, I want to make sure that the gu
property is set to true. I can easily stub save()
, however I can't verify that gu
is set to true since save()
is a function of the object and therefore it is not part of the parameters. Any ideas?