You've already forked matrix-js-sdk
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:
@ -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() {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
@ -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;
|
||||||
|
Reference in New Issue
Block a user