Update tests not to mock out an ancient server (#12081)
Some of our tests, which mock a `/versions` response, currently mock the response of a 2-year-old server. This will soon be incompatible with the JS-SDK. Update the tests in preparation.
This commit is contained in:
parent
86017639c2
commit
db7f0ba69a
3 changed files with 20 additions and 9 deletions
|
@ -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("<ServerPickerDialog />", () => {
|
||||
const defaultServerConfig = {
|
||||
hsUrl: "https://matrix.org",
|
||||
|
@ -112,7 +115,7 @@ describe("<ServerPickerDialog />", () => {
|
|||
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("<ServerPickerDialog />", () => {
|
|||
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("<ServerPickerDialog />", () => {
|
|||
|
||||
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("<ServerPickerDialog />", () => {
|
|||
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 });
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue