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 = []; observersCalled = [];
TestModel = dataSource.createModel('TestModel', { 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 }, name: { type: String, required: true },
extra: { type: String, required: false } extra: { type: String, required: false }
}); });
@ -712,6 +713,9 @@ module.exports = function(dataSource, should) {
existingInstance.save(function(err, instance) { existingInstance.save(function(err, instance) {
if (err) return done(err); 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({ observedContexts.should.eql(aTestModelCtx({
data: { data: {
id: existingInstance.id, id: existingInstance.id,
@ -719,8 +723,7 @@ module.exports = function(dataSource, should) {
}, },
currentInstance: { currentInstance: {
id: existingInstance.id, id: existingInstance.id,
name: 'changed', name: 'changed'
extra: undefined
}, },
where: { id: existingInstance.id }, where: { id: existingInstance.id },
options: { throws: false, validate: true } options: { throws: false, validate: true }