Merge pull request #71 from strongloop/fix/computed-options-arg
Add "options" arg to stubbed models in tests
This commit is contained in:
commit
1534626f01
|
@ -41,7 +41,13 @@ describe('RemoteConnector', function() {
|
||||||
it('should support the save method', function(done) {
|
it('should support the save method', function(done) {
|
||||||
var calledServerCreate = false;
|
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;
|
calledServerCreate = true;
|
||||||
data.id = 1;
|
data.id = 1;
|
||||||
if (callback) callback(null, data);
|
if (callback) callback(null, data);
|
||||||
|
@ -61,7 +67,12 @@ describe('RemoteConnector', function() {
|
||||||
it('should support aliases', function(done) {
|
it('should support aliases', function(done) {
|
||||||
var calledServerUpsert = false;
|
var calledServerUpsert = false;
|
||||||
ctx.ServerModel.patchOrCreate =
|
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;
|
calledServerUpsert = true;
|
||||||
cb();
|
cb();
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue