You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2025-08-06 12:02:40 +03:00
Appease jshint
This commit is contained in:
@@ -5,7 +5,6 @@ var HttpBackend = require("../mock-request");
|
|||||||
describe("MatrixClient", function() {
|
describe("MatrixClient", function() {
|
||||||
var baseUrl = "http://localhost.or.something";
|
var baseUrl = "http://localhost.or.something";
|
||||||
var client, httpBackend;
|
var client, httpBackend;
|
||||||
var requestPool = [];
|
|
||||||
|
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
httpBackend = new HttpBackend();
|
httpBackend = new HttpBackend();
|
||||||
|
@@ -8,16 +8,17 @@ function HttpBackend() {
|
|||||||
var realReq = new Request(opts.method, opts.uri, opts.body, opts.qs);
|
var realReq = new Request(opts.method, opts.uri, opts.body, opts.qs);
|
||||||
realReq.callback = callback;
|
realReq.callback = callback;
|
||||||
self.requests.push(realReq);
|
self.requests.push(realReq);
|
||||||
}
|
};
|
||||||
};
|
}
|
||||||
HttpBackend.prototype = {
|
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 matchingReq = null;
|
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];
|
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) {
|
||||||
@@ -31,9 +32,9 @@ HttpBackend.prototype = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (matchingReq) {
|
if (matchingReq) {
|
||||||
matchingReq.checks.forEach(function(check) {
|
for (i = 0; i < matchingReq.checks.length; i++) {
|
||||||
check(req);
|
matchingReq.checks[i](req);
|
||||||
});
|
}
|
||||||
var testResponse = matchingReq.response;
|
var testResponse = matchingReq.response;
|
||||||
req.callback(
|
req.callback(
|
||||||
testResponse.err, testResponse.response, testResponse.body
|
testResponse.err, testResponse.response, testResponse.body
|
||||||
@@ -69,7 +70,7 @@ function Request(method, path, data, queryParams) {
|
|||||||
this.callback = null;
|
this.callback = null;
|
||||||
this.response = null;
|
this.response = null;
|
||||||
this.checks = [];
|
this.checks = [];
|
||||||
};
|
}
|
||||||
Request.prototype = {
|
Request.prototype = {
|
||||||
check: function(fn) {
|
check: function(fn) {
|
||||||
this.checks.push(fn);
|
this.checks.push(fn);
|
||||||
|
Reference in New Issue
Block a user