Merge pull request #72 from strongloop/fix/computed-options-arg-1x

Add "options" arg to stubbed models in tests
This commit is contained in:
Miroslav Bajtoš 2016-12-22 12:00:41 +01:00 committed by GitHub
commit 69ebd5f931
1 changed files with 13 additions and 2 deletions

View File

@ -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);
@ -60,7 +66,12 @@ describe('RemoteConnector', function() {
it('should support aliases', function(done) {
var calledServerUpsert = false;
ctx.ServerModel.upsert = function(id, cb) {
ctx.ServerModel.upsert = function(id, options, cb) {
if (typeof options === 'function') {
cb = options;
options = {};
}
calledServerUpsert = true;
cb();
};