test/memory: remove dummy findOrCreate impl

Let the operation-hook tests use the real implementation,
now that we have it in place.
This commit is contained in:
Miroslav Bajtoš 2016-08-24 16:14:06 +02:00
parent 4ce8f97b15
commit 6d3ea21c16
1 changed files with 7 additions and 12 deletions

View File

@ -871,26 +871,21 @@ describe('Memory connector', function() {
describe('Optimized connector', function() { describe('Optimized connector', function() {
var ds = new DataSource({connector: Memory}); var ds = new DataSource({connector: Memory});
// optimized methods require('./persistence-hooks.suite')(ds, should, {
ds.connector.findOrCreate = function(model, query, data, callback) { replaceOrCreateReportsNewInstance: true,
this.all(model, query, {}, function(err, list) { });
if (err || (list && list[0])) return callback(err, list && list[0], false);
this.create(model, data, {}, function(err) {
callback(err, data, true);
});
}.bind(this));
};
require('./persistence-hooks.suite')(ds, should, {replaceOrCreateReportsNewInstance: true});
}); });
describe('Unoptimized connector', function() { describe('Unoptimized connector', function() {
var ds = new DataSource({connector: Memory}); var ds = new DataSource({connector: Memory});
// disable optimized methods // disable optimized methods
ds.connector.updateOrCreate = false; ds.connector.updateOrCreate = false;
ds.connector.findOrCreate = false; ds.connector.findOrCreate = false;
require('./persistence-hooks.suite')(ds, should, {replaceOrCreateReportsNewInstance: true}); require('./persistence-hooks.suite')(ds, should, {
replaceOrCreateReportsNewInstance: true,
});
}); });
describe('Memory connector with options', function() { describe('Memory connector with options', function() {