1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-07-31 15:24:23 +03:00

Appease closure linter.

This commit is contained in:
Kegan Dougal
2015-06-05 17:45:56 +01:00
parent be6ab91ab5
commit bf1a9f83e6
2 changed files with 11 additions and 8 deletions

View File

@ -37,7 +37,7 @@ describe("MatrixClient", function() {
httpBackend.flush(); 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() { " of /events", function() {
httpBackend.when("GET", "/initialSync").respond(200, initialSync); httpBackend.when("GET", "/initialSync").respond(200, initialSync);
httpBackend.when("GET", "/events").check(function(req) { httpBackend.when("GET", "/events").check(function(req) {
@ -50,4 +50,4 @@ describe("MatrixClient", function() {
}); });
}); });
}); });

View File

@ -1,9 +1,9 @@
"use strict"; "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() { function HttpBackend() {
this.requests = []; this.requests = [];
this.expectedRequests = []; this.expectedRequests = [];
@ -21,14 +21,14 @@ HttpBackend.prototype = {
*/ */
flush: function() { flush: function() {
// if there's more real requests and more expected requests, flush 'em. // 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 req = this.requests.shift();
var i; var i;
var matchingReq = null; var matchingReq = null;
for (i = 0; i < this.expectedRequests.length; i++) { for (i = 0; i < this.expectedRequests.length; i++) {
var expectedReq = this.expectedRequests[i]; var expectedReq = this.expectedRequests[i];
if (expectedReq.method === req.method && if (expectedReq.method === req.method &&
req.path.indexOf(expectedReq.path) !== -1) { req.path.indexOf(expectedReq.path) !== -1) {
if (!expectedReq.data || (JSON.stringify(expectedReq.data) === if (!expectedReq.data || (JSON.stringify(expectedReq.data) ===
JSON.stringify(req.data))) { JSON.stringify(req.data))) {
@ -57,7 +57,7 @@ HttpBackend.prototype = {
verifyNoOutstandingRequests: function() { verifyNoOutstandingRequests: function() {
var firstOutstandingReq = this.requests[0] || {}; var firstOutstandingReq = this.requests[0] || {};
expect(this.requests.length).toEqual(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 firstOutstandingReq.path
); );
}, },
@ -68,7 +68,7 @@ HttpBackend.prototype = {
verifyNoOutstandingExpectation: function() { verifyNoOutstandingExpectation: function() {
var firstOutstandingExpectation = this.expectedRequests[0] || {}; var firstOutstandingExpectation = this.expectedRequests[0] || {};
expect(this.expectedRequests.length).toEqual(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; module.exports = HttpBackend;