Skip to content

Commit

Permalink
fixed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
frozeman committed Sep 15, 2015
1 parent d09f65b commit ab5d8f5
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions test/helpers/FakeHttpProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ var getResponseStub = function () {
return {
jsonrpc: '2.0',
id: countId++,
result: 0
result: null
};
};

Expand All @@ -18,7 +18,7 @@ var getErrorStub = function () {
countId: countId++,
error: {
code: 1234,
message: ''
message: 'Stub error'
}
};
};
Expand All @@ -44,19 +44,18 @@ FakeHttpProvider.prototype.send = function (payload) {
};

FakeHttpProvider.prototype.sendAsync = function (payload, callback) {

assert.equal(utils.isArray(payload) || utils.isObject(payload), true);
assert.equal(utils.isFunction(callback), true);
if (this.validation) {
// imitate plain json object
this.validation(JSON.parse(JSON.stringify(payload)), callback);
}

var response = this.getResponse();
var response = this.getResponse(payload);
var error = this.error;
setTimeout(function(){
callback(error, response);
});
},1);
};

FakeHttpProvider.prototype.injectResponse = function (response) {
Expand Down

0 comments on commit ab5d8f5

Please sign in to comment.