diff --git a/spec/integ/matrix-client.spec.js b/spec/integ/matrix-client.spec.js index b20f3e6ac..33e550894 100644 --- a/spec/integ/matrix-client.spec.js +++ b/spec/integ/matrix-client.spec.js @@ -37,7 +37,7 @@ describe("MatrixClient", function() { httpBackend.flush(); }); - it("should pass the 'end' token from /initialSync to the from= param "+ + it("should pass the 'end' token from /initialSync to the from= param " + " of /events", function() { httpBackend.when("GET", "/initialSync").respond(200, initialSync); httpBackend.when("GET", "/events").check(function(req) { @@ -50,4 +50,4 @@ describe("MatrixClient", function() { }); }); -}); \ No newline at end of file +}); diff --git a/spec/mock-request.js b/spec/mock-request.js index f606310a7..9b0d16ed8 100644 --- a/spec/mock-request.js +++ b/spec/mock-request.js @@ -1,9 +1,9 @@ "use strict"; /** - * This is a mock framework for an HTTP backend, heavily inspired by Angular.js + * Construct a mock HTTP backend, heavily inspired by Angular.js. + * @constructor */ - function HttpBackend() { this.requests = []; this.expectedRequests = []; @@ -21,14 +21,14 @@ 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) { + while (this.requests.length > 0 && this.expectedRequests.length > 0) { var req = this.requests.shift(); var i; var matchingReq = null; for (i = 0; i < this.expectedRequests.length; i++) { var expectedReq = this.expectedRequests[i]; - if (expectedReq.method === req.method && + if (expectedReq.method === req.method && req.path.indexOf(expectedReq.path) !== -1) { if (!expectedReq.data || (JSON.stringify(expectedReq.data) === JSON.stringify(req.data))) { @@ -57,7 +57,7 @@ HttpBackend.prototype = { verifyNoOutstandingRequests: function() { var firstOutstandingReq = this.requests[0] || {}; expect(this.requests.length).toEqual(0, - "Expected no more HTTP requests but received request to "+ + "Expected no more HTTP requests but received request to " + firstOutstandingReq.path ); }, @@ -68,7 +68,7 @@ HttpBackend.prototype = { verifyNoOutstandingExpectation: function() { var firstOutstandingExpectation = this.expectedRequests[0] || {}; expect(this.expectedRequests.length).toEqual(0, - "Expected to see HTTP request for "+firstOutstandingExpectation.path + "Expected to see HTTP request for " + firstOutstandingExpectation.path ); }, @@ -139,4 +139,7 @@ Request.prototype = { } }; +/** + * The HttpBackend class. + */ module.exports = HttpBackend;