diff --git a/test/unit-tests/async-components/dialogs/security/NewRecoveryMethodDialog-test.tsx b/test/unit-tests/async-components/dialogs/security/NewRecoveryMethodDialog-test.tsx index fc964e57bf4..c97f76be3c3 100644 --- a/test/unit-tests/async-components/dialogs/security/NewRecoveryMethodDialog-test.tsx +++ b/test/unit-tests/async-components/dialogs/security/NewRecoveryMethodDialog-test.tsx @@ -7,10 +7,9 @@ import React from "react"; import { MatrixClient } from "matrix-js-sdk/src/matrix"; -import { render, screen } from "jest-matrix-react"; +import { render, screen, act } from "jest-matrix-react"; import { waitFor } from "@testing-library/dom"; import userEvent from "@testing-library/user-event"; -import { act } from "@testing-library/react-hooks/dom"; import NewRecoveryMethodDialog from "../../../../../src/async-components/views/dialogs/security/NewRecoveryMethodDialog"; import { createTestClient } from "../../../../test-utils"; diff --git a/test/unit-tests/components/views/dialogs/security/ExportE2eKeysDialog-test.tsx b/test/unit-tests/components/views/dialogs/security/ExportE2eKeysDialog-test.tsx index b0ee3531e2a..88333b13b8e 100644 --- a/test/unit-tests/components/views/dialogs/security/ExportE2eKeysDialog-test.tsx +++ b/test/unit-tests/components/views/dialogs/security/ExportE2eKeysDialog-test.tsx @@ -35,10 +35,9 @@ describe("ExportE2eKeysDialog", () => { const cli = createTestClient(); const onFinished = jest.fn(); - const { container } = render(); + render(); const input = screen.getByLabelText("Enter passphrase"); await userEvent.type(input, "password"); - fireEvent.click(container.querySelector("[type=submit]")!); await expect(screen.findByText("This is a top-10 common password")).resolves.toBeInTheDocument(); }); diff --git a/test/unit-tests/components/views/settings/CryptographyPanel-test.tsx b/test/unit-tests/components/views/settings/CryptographyPanel-test.tsx index ad658b5764e..a7493f9e9bb 100644 --- a/test/unit-tests/components/views/settings/CryptographyPanel-test.tsx +++ b/test/unit-tests/components/views/settings/CryptographyPanel-test.tsx @@ -7,7 +7,7 @@ Please see LICENSE files in the repository root for full details. */ import React from "react"; -import { render } from "jest-matrix-react"; +import { render, waitFor } from "jest-matrix-react"; import { MatrixClient } from "matrix-js-sdk/src/matrix"; import { mocked } from "jest-mock"; @@ -28,7 +28,7 @@ describe("CryptographyPanel", () => { mocked(client.getCrypto()!.getOwnDeviceKeys).mockResolvedValue({ ed25519: sessionKey, curve25519: "1234" }); // When we render the CryptographyPanel - const rendered = render(); + const rendered = render(, { legacyRoot: true }); // Then it displays info about the user's session const codes = rendered.container.querySelectorAll("code"); @@ -39,8 +39,7 @@ describe("CryptographyPanel", () => { expect(codes[1].innerHTML).toEqual("..."); // Then the actual key - await TestUtils.flushPromises(); - expect(codes[1].innerHTML).toEqual(sessionKeyFormatted); + await waitFor(() => expect(codes[1].innerHTML).toEqual(sessionKeyFormatted)); }); it("handles errors fetching session key", async () => {