From 6d3ea21c169da140a6584692f3b1203392de2c6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20Bajto=C5=A1?= Date: Wed, 24 Aug 2016 16:14:06 +0200 Subject: [PATCH] test/memory: remove dummy findOrCreate impl Let the operation-hook tests use the real implementation, now that we have it in place. --- test/memory.test.js | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/test/memory.test.js b/test/memory.test.js index 0bd3ba2c..50dfc287 100644 --- a/test/memory.test.js +++ b/test/memory.test.js @@ -871,26 +871,21 @@ describe('Memory connector', function() { describe('Optimized connector', function() { var ds = new DataSource({connector: Memory}); - // optimized methods - ds.connector.findOrCreate = function(model, query, data, callback) { - 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}); + require('./persistence-hooks.suite')(ds, should, { + replaceOrCreateReportsNewInstance: true, + }); }); describe('Unoptimized connector', function() { var ds = new DataSource({connector: Memory}); + // disable optimized methods ds.connector.updateOrCreate = 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() {