From 82f215939d151c28cfe47f4d1cd0c8c8ceec63a4 Mon Sep 17 00:00:00 2001 From: Fabian Vogelsteller Date: Mon, 14 Sep 2015 12:05:01 +0200 Subject: [PATCH] made fakehttp provider async really async --- test/helpers/FakeHttpProvider.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/test/helpers/FakeHttpProvider.js b/test/helpers/FakeHttpProvider.js index 1e6ce12..a327af1 100644 --- a/test/helpers/FakeHttpProvider.js +++ b/test/helpers/FakeHttpProvider.js @@ -41,13 +41,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); } - callback(this.error, this.getResponse()); + var response = this.getResponse(); + var error = this.error; + setTimeout(function(){ + callback(error, response); + }); }; FakeHttpProvider.prototype.injectResponse = function (response) {