Fix the test case

This commit is contained in:
Raymond Feng 2015-06-16 13:35:35 -07:00
parent 62f3f3af0d
commit 97f905ff1f
1 changed files with 17 additions and 14 deletions

View File

@ -15,7 +15,8 @@ module.exports = function(dataSource, should) {
observersCalled = [];
TestModel = dataSource.createModel('TestModel', {
id: { type: String, id: true, default: uid },
// Set id.generated to false to honor client side values
id: { type: String, id: true, generated: false, default: uid },
name: { type: String, required: true },
extra: { type: String, required: false }
});
@ -712,6 +713,9 @@ module.exports = function(dataSource, should) {
existingInstance.save(function(err, instance) {
if (err) return done(err);
// HACK: extra is undefined for NoSQL and null for SQL
delete observedContexts.data.extra;
delete observedContexts.currentInstance.extra;
observedContexts.should.eql(aTestModelCtx({
data: {
id: existingInstance.id,
@ -719,8 +723,7 @@ module.exports = function(dataSource, should) {
},
currentInstance: {
id: existingInstance.id,
name: 'changed',
extra: undefined
name: 'changed'
},
where: { id: existingInstance.id },
options: { throws: false, validate: true }