You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2025-11-25 05:23:13 +03:00
Replace rest of defers
This commit is contained in:
@@ -256,7 +256,7 @@ HttpResponse.prototype.request = function HttpResponse(
|
|||||||
if (!next) { // no more things to return
|
if (!next) { // no more things to return
|
||||||
if (method === "GET" && path === "/sync" && this.ignoreUnhandledSync) {
|
if (method === "GET" && path === "/sync" && this.ignoreUnhandledSync) {
|
||||||
logger.log("MatrixClient[UT] Ignoring.");
|
logger.log("MatrixClient[UT] Ignoring.");
|
||||||
return Promise.defer().promise;
|
return new Promise(() => {});
|
||||||
}
|
}
|
||||||
if (this.pendingLookup) {
|
if (this.pendingLookup) {
|
||||||
if (this.pendingLookup.method === method
|
if (this.pendingLookup.method === method
|
||||||
@@ -271,7 +271,7 @@ HttpResponse.prototype.request = function HttpResponse(
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
this.pendingLookup = {
|
this.pendingLookup = {
|
||||||
promise: Promise.defer().promise,
|
promise: new Promise(() => {}),
|
||||||
method: method,
|
method: method,
|
||||||
path: path,
|
path: path,
|
||||||
};
|
};
|
||||||
@@ -308,10 +308,10 @@ HttpResponse.prototype.request = function HttpResponse(
|
|||||||
} else if (method === "GET" && path === "/sync" && this.ignoreUnhandledSync) {
|
} else if (method === "GET" && path === "/sync" && this.ignoreUnhandledSync) {
|
||||||
logger.log("MatrixClient[UT] Ignoring.");
|
logger.log("MatrixClient[UT] Ignoring.");
|
||||||
this.httpLookups.unshift(next);
|
this.httpLookups.unshift(next);
|
||||||
return Promise.defer().promise;
|
return new Promise(() => {});
|
||||||
}
|
}
|
||||||
expect(true).toBe(false, "Expected different request. " + logLine);
|
expect(true).toBe(false, "Expected different request. " + logLine);
|
||||||
return Promise.defer().promise;
|
return new Promise(() => {});
|
||||||
};
|
};
|
||||||
|
|
||||||
HttpResponse.KEEP_ALIVE_PATH = "/_matrix/client/versions";
|
HttpResponse.KEEP_ALIVE_PATH = "/_matrix/client/versions";
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ describe("MatrixClient", function() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
pendingLookup = {
|
pendingLookup = {
|
||||||
promise: Promise.defer().promise,
|
promise: new Promise(() => {}),
|
||||||
method: method,
|
method: method,
|
||||||
path: path,
|
path: path,
|
||||||
};
|
};
|
||||||
@@ -119,7 +119,7 @@ describe("MatrixClient", function() {
|
|||||||
return Promise.resolve(next.data);
|
return Promise.resolve(next.data);
|
||||||
}
|
}
|
||||||
expect(true).toBe(false, "Expected different request. " + logLine);
|
expect(true).toBe(false, "Expected different request. " + logLine);
|
||||||
return Promise.defer().promise;
|
return new Promise(() => {});
|
||||||
}
|
}
|
||||||
|
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
@@ -171,7 +171,7 @@ describe("MatrixClient", function() {
|
|||||||
// a DIFFERENT test (pollution between tests!) - we return unresolved
|
// a DIFFERENT test (pollution between tests!) - we return unresolved
|
||||||
// promises to stop the client from continuing to run.
|
// promises to stop the client from continuing to run.
|
||||||
client._http.authedRequest.mockImplementation(function() {
|
client._http.authedRequest.mockImplementation(function() {
|
||||||
return Promise.defer().promise;
|
return new Promise(() => {});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user