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
|
@ -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<MatrixClient>;
|
||||
|
||||
|
@ -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…"));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue