From 127b54223398b4e6e3191eff402daedce8e4a415 Mon Sep 17 00:00:00 2001 From: Florian Duros Date: Wed, 14 Jun 2023 11:46:14 +0200 Subject: [PATCH] Use `crypto.isCrossSigningReady` in `CrossSigningPanel` (#11080) --- src/components/views/settings/CrossSigningPanel.tsx | 2 +- test/components/views/settings/CrossSigningPanel-test.tsx | 6 +----- test/test-utils/client.ts | 1 + 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/components/views/settings/CrossSigningPanel.tsx b/src/components/views/settings/CrossSigningPanel.tsx index c9208ca903..f5b893e4ea 100644 --- a/src/components/views/settings/CrossSigningPanel.tsx +++ b/src/components/views/settings/CrossSigningPanel.tsx @@ -102,7 +102,7 @@ export default class CrossSigningPanel extends React.PureComponent<{}, IState> { const homeserverSupportsCrossSigning = await cli.doesServerSupportUnstableFeature( "org.matrix.e2e_cross_signing", ); - const crossSigningReady = await cli.isCrossSigningReady(); + const crossSigningReady = await crypto.isCrossSigningReady(); this.setState({ crossSigningPublicKeysOnDevice, diff --git a/test/components/views/settings/CrossSigningPanel-test.tsx b/test/components/views/settings/CrossSigningPanel-test.tsx index b9fd22dc44..96c65fd5c6 100644 --- a/test/components/views/settings/CrossSigningPanel-test.tsx +++ b/test/components/views/settings/CrossSigningPanel-test.tsx @@ -59,10 +59,6 @@ describe("", () => { }); describe("when cross signing is ready", () => { - beforeEach(() => { - mockClient.isCrossSigningReady.mockResolvedValue(true); - }); - it("should render when keys are not backed up", async () => { getComponent(); await flushPromises(); @@ -93,7 +89,7 @@ describe("", () => { describe("when cross signing is not ready", () => { beforeEach(() => { - mockClient.isCrossSigningReady.mockResolvedValue(false); + mocked(mockClient.getCrypto()!.isCrossSigningReady).mockResolvedValue(false); }); it("should render when keys are not backed up", async () => { diff --git a/test/test-utils/client.ts b/test/test-utils/client.ts index 177e06abc1..582099d683 100644 --- a/test/test-utils/client.ts +++ b/test/test-utils/client.ts @@ -167,5 +167,6 @@ export const mockClientMethodsCrypto = (): Partial< userSigningKey: true, }, }), + isCrossSigningReady: jest.fn().mockResolvedValue(true), }), });