From a11d1d33e4f6ed24b01fe22324bbfa224f17b202 Mon Sep 17 00:00:00 2001 From: David Baker Date: Thu, 17 Oct 2024 11:54:57 +0100 Subject: [PATCH] Use the right mock --- .../unit-tests/components/structures/MatrixChat-test.tsx | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/test/unit-tests/components/structures/MatrixChat-test.tsx b/test/unit-tests/components/structures/MatrixChat-test.tsx index bf236fd918..e61ff5ee05 100644 --- a/test/unit-tests/components/structures/MatrixChat-test.tsx +++ b/test/unit-tests/components/structures/MatrixChat-test.tsx @@ -135,9 +135,9 @@ describe("", () => { getVersion: jest.fn().mockReturnValue("1"), setDeviceIsolationMode: jest.fn(), userHasCrossSigningKeys: jest.fn(), + // This needs to not finish immediately because we need to test the screen appears + bootstrapCrossSigning: jest.fn().mockImplementation(() => bootstrapDeferred.promise), }), - // This needs to not finish immediately because we need to test the screen appears - bootstrapCrossSigning: jest.fn().mockImplementation(() => bootstrapDeferred.promise), secretStorage: { isStored: jest.fn().mockReturnValue(null), }, @@ -1010,7 +1010,8 @@ describe("", () => { .mockResolvedValue(new UserVerificationStatus(false, false, false)), setDeviceIsolationMode: jest.fn(), userHasCrossSigningKeys: jest.fn().mockResolvedValue(false), - bootstrapCrossSigning: jest.fn(), + // This needs to not finish immediately because we need to test the screen appears + bootstrapCrossSigning: jest.fn().mockImplementation(() => bootstrapDeferred.promise), }; loginClient.getCrypto.mockReturnValue(mockCrypto as any); }); @@ -1114,8 +1115,6 @@ describe("", () => { expect(loginClient.getCrypto()!.userHasCrossSigningKeys).toHaveBeenCalled(); - await flushPromises(); - // set up keys screen is rendered expect(screen.getByText("Setting up keys")).toBeInTheDocument(); });