From 1168bb60805fd3137f08a08ca5cded1988ad5e3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20Bajto=C5=A1?= Date: Thu, 22 Dec 2016 10:56:11 +0100 Subject: [PATCH] Add "options" arg to stubbed models in tests --- test/remote-connector.test.js | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/test/remote-connector.test.js b/test/remote-connector.test.js index ba0acdd..eb002ff 100644 --- a/test/remote-connector.test.js +++ b/test/remote-connector.test.js @@ -41,7 +41,13 @@ describe('RemoteConnector', function() { it('should support the save method', function(done) { var calledServerCreate = false; - ctx.ServerModel.create = function(data, cb, callback) { + ctx.ServerModel.create = function(data, options, cb, callback) { + if (typeof options === 'function') { + callback = cb; + cb = options; + options = {}; + } + calledServerCreate = true; data.id = 1; if (callback) callback(null, data); @@ -61,7 +67,12 @@ describe('RemoteConnector', function() { it('should support aliases', function(done) { var calledServerUpsert = false; ctx.ServerModel.patchOrCreate = - ctx.ServerModel.upsert = function(id, cb) { + ctx.ServerModel.upsert = function(id, options, cb) { + if (typeof options === 'function') { + cb = options; + options = {}; + } + calledServerUpsert = true; cb(); };