From 3d90942e9bbbeb0db228fd8f7cb1be5e60e3932a Mon Sep 17 00:00:00 2001 From: Kegan Dougal Date: Fri, 5 Jun 2015 17:36:15 +0100 Subject: [PATCH] Appease jshint --- spec/integ/matrix-client.spec.js | 3 +-- spec/mock-request.js | 15 ++++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/spec/integ/matrix-client.spec.js b/spec/integ/matrix-client.spec.js index 90f0db3c5..b20f3e6ac 100644 --- a/spec/integ/matrix-client.spec.js +++ b/spec/integ/matrix-client.spec.js @@ -5,7 +5,6 @@ var HttpBackend = require("../mock-request"); describe("MatrixClient", function() { var baseUrl = "http://localhost.or.something"; var client, httpBackend; - var requestPool = []; beforeEach(function() { httpBackend = new HttpBackend(); @@ -46,7 +45,7 @@ describe("MatrixClient", function() { }).respond(200, eventData); client.startClient(function(err, data, isLive) {}); - + httpBackend.flush(); }); }); diff --git a/spec/mock-request.js b/spec/mock-request.js index 1757d3551..eb5b931dd 100644 --- a/spec/mock-request.js +++ b/spec/mock-request.js @@ -8,16 +8,17 @@ function HttpBackend() { var realReq = new Request(opts.method, opts.uri, opts.body, opts.qs); realReq.callback = callback; self.requests.push(realReq); - } -}; + }; +} HttpBackend.prototype = { flush: function() { // if there's more real requests and more expected requests, flush 'em. while(this.requests.length > 0 && this.expectedRequests.length > 0) { var req = this.requests.shift(); + var i; var matchingReq = null; - for (var i = 0; i < this.expectedRequests.length; i++) { + for (i = 0; i < this.expectedRequests.length; i++) { var expectedReq = this.expectedRequests[i]; if (expectedReq.method === req.method && req.path.indexOf(expectedReq.path) !== -1) { @@ -31,9 +32,9 @@ HttpBackend.prototype = { } if (matchingReq) { - matchingReq.checks.forEach(function(check) { - check(req); - }); + for (i = 0; i < matchingReq.checks.length; i++) { + matchingReq.checks[i](req); + } var testResponse = matchingReq.response; req.callback( testResponse.err, testResponse.response, testResponse.body @@ -69,7 +70,7 @@ function Request(method, path, data, queryParams) { this.callback = null; this.response = null; this.checks = []; -}; +} Request.prototype = { check: function(fn) { this.checks.push(fn);