Fix tests for Matrix v1.1 requirement (#25898)

pull/25938/head
Michael Telatynski 2023-08-14 09:07:43 +01:00 committed by GitHub
parent d1f7b0898a
commit 7351c722be
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 8 deletions

View File

@ -158,10 +158,8 @@ describe("loading:", function () {
async function expectAndAwaitSync(opts?: { isGuest?: boolean }): Promise<any> { async function expectAndAwaitSync(opts?: { isGuest?: boolean }): Promise<any> {
let syncRequest: (typeof MockHttpBackend.prototype.requests)[number] | null = null; let syncRequest: (typeof MockHttpBackend.prototype.requests)[number] | null = null;
httpBackend.when("GET", "/_matrix/client/versions").respond(200, { httpBackend.when("GET", "/_matrix/client/versions").respond(200, {
versions: ["r0.3.0"], versions: ["v1.1"],
unstable_features: { unstable_features: {},
"m.lazy_load_members": true,
},
}); });
const isGuest = opts?.isGuest; const isGuest = opts?.isGuest;
if (!isGuest) { if (!isGuest) {
@ -220,7 +218,7 @@ describe("loading:", function () {
}); });
// Pass the liveliness checks // Pass the liveliness checks
httpBackend.when("GET", "/versions").respond(200, { versions: ["r0.4.0"] }); httpBackend.when("GET", "/versions").respond(200, { versions: ["v1.1"] });
httpBackend.when("GET", "/_matrix/identity/v2").respond(200, {}); httpBackend.when("GET", "/_matrix/identity/v2").respond(200, {});
return sleep(1) return sleep(1)
@ -270,7 +268,7 @@ describe("loading:", function () {
}); });
// Pass the liveliness checks // Pass the liveliness checks
httpBackend.when("GET", "/versions").respond(200, { versions: ["r0.4.0"] }); httpBackend.when("GET", "/versions").respond(200, { versions: ["v1.1"] });
httpBackend.when("GET", "/_matrix/identity/v2").respond(200, {}); httpBackend.when("GET", "/_matrix/identity/v2").respond(200, {});
return awaitLoginComponent(matrixChat) return awaitLoginComponent(matrixChat)
@ -283,7 +281,7 @@ describe("loading:", function () {
// the only outstanding request should be a GET /login // the only outstanding request should be a GET /login
// (in particular there should be no /register request for // (in particular there should be no /register request for
// guest registration). // guest registration).
const allowedRequests = ["/_matrix/client/r0/login", "/versions", "/_matrix/identity/v2"]; const allowedRequests = ["/_matrix/client/v3/login", "/versions", "/_matrix/identity/v2"];
for (const req of httpBackend.requests) { for (const req of httpBackend.requests) {
if (req.method === "GET" && allowedRequests.find((p) => req.path.endsWith(p))) { if (req.method === "GET" && allowedRequests.find((p) => req.path.endsWith(p))) {
continue; continue;

View File

@ -29,7 +29,7 @@ describe("Loading server config", function () {
PlatformPeg.set(new WebPlatform()); PlatformPeg.set(new WebPlatform());
fetchMock.get("https://matrix-client.matrix.org/_matrix/client/versions", { fetchMock.get("https://matrix-client.matrix.org/_matrix/client/versions", {
unstable_features: {}, unstable_features: {},
versions: [], versions: ["v1.1"],
}); });
fetchMock.get("https://matrix.org/.well-known/matrix/client", { fetchMock.get("https://matrix.org/.well-known/matrix/client", {
"m.homeserver": { "m.homeserver": {