Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit 46c0d9e

Browse files
committed
Make mocking work with current release of js-sdk as well as anticipated future
1 parent f6cbc7a commit 46c0d9e

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

test/components/views/settings/devices/LoginWithQR-test.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import { cleanup, render, waitFor } from "@testing-library/react";
1818
import { mocked } from "jest-mock";
1919
import React from "react";
2020
import { MSC3906Rendezvous, RendezvousFailureReason } from "matrix-js-sdk/src/rendezvous";
21+
import { LoginTokenPostResponse } from "matrix-js-sdk/src/@types/auth";
2122

2223
import LoginWithQR, { Click, Mode, Phase } from "../../../../../src/components/views/auth/LoginWithQR";
2324
import type { MatrixClient } from "matrix-js-sdk/src/matrix";
@@ -87,8 +88,9 @@ describe("<LoginWithQR />", () => {
8788
jest.spyOn(MSC3906Rendezvous.prototype, "verifyNewDeviceOnExistingDevice").mockResolvedValue(undefined);
8889
client.requestLoginToken.mockResolvedValue({
8990
login_token: "token",
90-
expires_in: 1000,
91-
});
91+
expires_in: 1000, // this is as per MSC3882 r0
92+
expires_in_ms: 1000 * 1000, // this is as per MSC3882 r1
93+
} as LoginTokenPostResponse); // we force the type here so that it works with versions of js-sdk that don't have r1 support yet
9294
});
9395

9496
afterEach(() => {

0 commit comments

Comments
 (0)