Assert the existence of instance
This commit is contained in:
parent
542afefb1d
commit
bcd477358f
|
@ -245,6 +245,7 @@ module.exports = function(dataSource, should) {
|
|||
// updates from `persist` hook are reflected into database
|
||||
TestModel.findById('new-id', function(err, dbInstance) {
|
||||
if (err) return done(err);
|
||||
should.exists(dbInstance);
|
||||
dbInstance.toObject(true).should.eql({
|
||||
id: 'new-id',
|
||||
name: 'a name',
|
||||
|
@ -634,6 +635,7 @@ module.exports = function(dataSource, should) {
|
|||
// updates from `persist` hook
|
||||
TestModel.findById(existingInstance.id, function(err, dbInstance) {
|
||||
if (err) return done(err);
|
||||
should.exists(dbInstance);
|
||||
dbInstance.toObject(true).should.eql({
|
||||
id: existingInstance.id,
|
||||
name: existingInstance.name,
|
||||
|
@ -671,6 +673,7 @@ module.exports = function(dataSource, should) {
|
|||
instance.should.not.have.property('extra', 'hook data');
|
||||
TestModel.findById(instance.id, function(err, dbInstance) {
|
||||
if (err) return done(err);
|
||||
should.exists(dbInstance);
|
||||
dbInstance.toObject(true).should.eql({
|
||||
id: instance.id,
|
||||
name: instance.name,
|
||||
|
@ -1094,6 +1097,7 @@ module.exports = function(dataSource, should) {
|
|||
// returns effectively `this`, not the data from the datasource
|
||||
TestModel.findById(existingInstance.id, function(err, instance) {
|
||||
if (err) return done(err);
|
||||
should.exists(instance);
|
||||
instance.toObject(true).should.eql({
|
||||
id: existingInstance.id,
|
||||
name: 'hooked name',
|
||||
|
|
Loading…
Reference in New Issue