parse-mock icon indicating copy to clipboard operation
parse-mock copied to clipboard

How to get parameter from stub of "Parse Query Get" method ?

Open minjimwu opened this issue 9 years ago • 1 comments

new Parse.Query('User').get(1).then(function(user){...});

here is my test code, is it possible to use stub like this ?

var stub = Parse.Mock.stubQueryGet(function(options) { if (options == 1) return mockUser1; else if (options == 2) return mockUser2; });

minjimwu avatar May 14 '15 15:05 minjimwu

after I change line 33, it seems working :) , but I am not sure it's a good solution.

return registerStub(sinon.stub(object, methodName, function (options) { var promise = new Parse.Promise()._thenRunCallbacks(options), data = cb.call(this, queryToJSON(this), options); <===

minjimwu avatar May 14 '15 15:05 minjimwu