diff --git a/test/components/structures/MatrixChat-test.tsx b/test/components/structures/MatrixChat-test.tsx
index bd1219c359..9004a461fa 100644
--- a/test/components/structures/MatrixChat-test.tsx
+++ b/test/components/structures/MatrixChat-test.tsx
@@ -62,6 +62,9 @@ jest.mock("matrix-js-sdk/src/oidc/authorize", () => ({
completeAuthorizationCodeGrant: jest.fn(),
}));
+/** The matrix versions our mock server claims to support */
+const SERVER_SUPPORTED_MATRIX_VERSIONS = ["v1.1", "v1.5", "v1.6", "v1.8", "v1.9"];
+
describe("", () => {
const userId = "@alice:server.org";
const deviceId = "qwertyui";
@@ -69,7 +72,7 @@ describe("", () => {
// reused in createClient mock below
const getMockClientMethods = () => ({
...mockClientMethodsUser(userId),
- getVersions: jest.fn().mockResolvedValue({ versions: ["v1.1"] }),
+ getVersions: jest.fn().mockResolvedValue({ versions: SERVER_SUPPORTED_MATRIX_VERSIONS }),
startClient: jest.fn(),
stopClient: jest.fn(),
setCanResetTimelineCallback: jest.fn(),
@@ -202,7 +205,7 @@ describe("", () => {
mockClient = getMockClientWithEventEmitter(getMockClientMethods());
fetchMock.get("https://test.com/_matrix/client/versions", {
unstable_features: {},
- versions: ["v1.1"],
+ versions: SERVER_SUPPORTED_MATRIX_VERSIONS,
});
jest.spyOn(StorageManager, "idbLoad").mockReset();
diff --git a/test/components/structures/auth/Registration-test.tsx b/test/components/structures/auth/Registration-test.tsx
index e3b941d5a7..8a84bf17a4 100644
--- a/test/components/structures/auth/Registration-test.tsx
+++ b/test/components/structures/auth/Registration-test.tsx
@@ -39,6 +39,9 @@ jest.mock("matrix-js-sdk/src/matrix", () => ({
}));
jest.useFakeTimers();
+/** The matrix versions our mock server claims to support */
+const SERVER_SUPPORTED_MATRIX_VERSIONS = ["v1.1", "v1.5", "v1.6", "v1.8", "v1.9"];
+
describe("Registration", function () {
let mockClient!: MockedObject;
@@ -50,7 +53,7 @@ describe("Registration", function () {
mockClient = getMockClientWithEventEmitter({
registerRequest: jest.fn(),
loginFlows: jest.fn(),
- getVersions: jest.fn().mockResolvedValue({ versions: ["v1.1"] }),
+ getVersions: jest.fn().mockResolvedValue({ versions: SERVER_SUPPORTED_MATRIX_VERSIONS }),
});
mockClient.registerRequest.mockRejectedValueOnce(
new MatrixError(
@@ -69,7 +72,7 @@ describe("Registration", function () {
fetchMock.catch(404);
fetchMock.get("https://matrix.org/_matrix/client/versions", {
unstable_features: {},
- versions: ["v1.1"],
+ versions: SERVER_SUPPORTED_MATRIX_VERSIONS,
});
mockPlatformPeg({
startSingleSignOn: jest.fn(),
@@ -138,7 +141,7 @@ describe("Registration", function () {
fetchMock.get("https://server2/_matrix/client/versions", {
unstable_features: {},
- versions: ["v1.1"],
+ versions: SERVER_SUPPORTED_MATRIX_VERSIONS,
});
rerender(getRawComponent("https://server2"));
await waitForElementToBeRemoved(() => screen.queryAllByLabelText("Loading…"));
diff --git a/test/components/views/dialogs/ServerPickerDialog-test.tsx b/test/components/views/dialogs/ServerPickerDialog-test.tsx
index 73ee07e4c0..46594ea635 100644
--- a/test/components/views/dialogs/ServerPickerDialog-test.tsx
+++ b/test/components/views/dialogs/ServerPickerDialog-test.tsx
@@ -23,6 +23,9 @@ import SdkConfig from "../../../../src/SdkConfig";
import { flushPromises } from "../../../test-utils";
import { ValidatedServerConfig } from "../../../../src/utils/ValidatedServerConfig";
+/** The matrix versions our mock server claims to support */
+const SERVER_SUPPORTED_MATRIX_VERSIONS = ["v1.1", "v1.5", "v1.6", "v1.8", "v1.9"];
+
describe("", () => {
const defaultServerConfig = {
hsUrl: "https://matrix.org",
@@ -112,7 +115,7 @@ describe("", () => {
it("should allow user to revert from a custom server to the default", async () => {
fetchMock.get(`https://custom.org/_matrix/client/versions`, {
unstable_features: {},
- versions: ["v1.1"],
+ versions: SERVER_SUPPORTED_MATRIX_VERSIONS,
});
const onFinished = jest.fn();
@@ -142,7 +145,7 @@ describe("", () => {
const homeserver = "https://myhomeserver.site";
fetchMock.get(`${homeserver}/_matrix/client/versions`, {
unstable_features: {},
- versions: ["v1.1"],
+ versions: SERVER_SUPPORTED_MATRIX_VERSIONS,
});
const onFinished = jest.fn();
getComponent({ onFinished });
@@ -195,7 +198,7 @@ describe("", () => {
fetchMock.getOnce(wellKnownUrl, validWellKnown);
fetchMock.getOnce(versionsUrl, {
- versions: ["v1.1"],
+ versions: SERVER_SUPPORTED_MATRIX_VERSIONS,
});
fetchMock.getOnce(isWellKnownUrl, {});
const onFinished = jest.fn();
@@ -231,7 +234,9 @@ describe("", () => {
const wellKnownUrl = `https://${homeserver}/.well-known/matrix/client`;
fetchMock.get(wellKnownUrl, { status: 404 });
// but is otherwise live (happy versions response)
- fetchMock.get(`https://${homeserver}/_matrix/client/versions`, { versions: ["v1.1"] });
+ fetchMock.get(`https://${homeserver}/_matrix/client/versions`, {
+ versions: SERVER_SUPPORTED_MATRIX_VERSIONS,
+ });
const onFinished = jest.fn();
getComponent({ onFinished });