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
|
@ -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("<MatrixChat />", () => {
|
||||
const userId = "@alice:server.org";
|
||||
const deviceId = "qwertyui";
|
||||
|
@ -69,7 +72,7 @@ describe("<MatrixChat />", () => {
|
|||
// 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("<MatrixChat />", () => {
|
|||
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();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue