From 47ab99f9081acd634b43d41fb8d29bc4f42f0614 Mon Sep 17 00:00:00 2001 From: Richard van der Hoff <1389908+richvdh@users.noreply.github.com> Date: Fri, 9 Jun 2023 16:49:44 +0100 Subject: [PATCH] remove references to `VerificationBase` (#10996) --- src/components/views/dialogs/IncomingSasDialog.tsx | 5 ++--- .../views/dialogs/IncomingSasDialog-test.tsx | 8 ++++---- .../views/right_panel/VerificationPanel-test.tsx | 10 +++++----- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/src/components/views/dialogs/IncomingSasDialog.tsx b/src/components/views/dialogs/IncomingSasDialog.tsx index 3772b689fa2..3c99f327b63 100644 --- a/src/components/views/dialogs/IncomingSasDialog.tsx +++ b/src/components/views/dialogs/IncomingSasDialog.tsx @@ -15,8 +15,7 @@ limitations under the License. */ import React, { ReactNode } from "react"; -import { VerificationBase } from "matrix-js-sdk/src/crypto/verification/Base"; -import { GeneratedSas, ShowSasCallbacks, VerifierEvent } from "matrix-js-sdk/src/crypto-api/verification"; +import { GeneratedSas, ShowSasCallbacks, Verifier, VerifierEvent } from "matrix-js-sdk/src/crypto-api/verification"; import { logger } from "matrix-js-sdk/src/logger"; import { MatrixClientPeg } from "../../../MatrixClientPeg"; @@ -37,7 +36,7 @@ const PHASE_VERIFIED = 3; const PHASE_CANCELLED = 4; interface IProps { - verifier: VerificationBase; + verifier: Verifier; onFinished(verified?: boolean): void; } diff --git a/test/components/views/dialogs/IncomingSasDialog-test.tsx b/test/components/views/dialogs/IncomingSasDialog-test.tsx index 61b9f21e03b..7c4962273c9 100644 --- a/test/components/views/dialogs/IncomingSasDialog-test.tsx +++ b/test/components/views/dialogs/IncomingSasDialog-test.tsx @@ -17,10 +17,10 @@ limitations under the License. import { act, render } from "@testing-library/react"; import React from "react"; import { Mocked } from "jest-mock"; -import { VerificationBase } from "matrix-js-sdk/src/crypto/verification/Base"; import { EmojiMapping, ShowSasCallbacks, + Verifier, VerifierEvent, VerifierEventHandlerMap, } from "matrix-js-sdk/src/crypto-api/verification"; @@ -58,16 +58,16 @@ describe("IncomingSasDialog", () => { }); }); -function renderComponent(verifier: VerificationBase, onFinished = () => true) { +function renderComponent(verifier: Verifier, onFinished = () => true) { return render(); } -function makeMockVerifier(): Mocked { +function makeMockVerifier(): Mocked { const verifier = new TypedEventEmitter(); Object.assign(verifier, { cancel: jest.fn(), }); - return verifier as unknown as Mocked; + return verifier as unknown as Mocked; } function makeMockSasCallbacks(): ShowSasCallbacks { diff --git a/test/components/views/right_panel/VerificationPanel-test.tsx b/test/components/views/right_panel/VerificationPanel-test.tsx index 7fdab5248fe..9b43e418b5c 100644 --- a/test/components/views/right_panel/VerificationPanel-test.tsx +++ b/test/components/views/right_panel/VerificationPanel-test.tsx @@ -24,10 +24,10 @@ import { import { TypedEventEmitter } from "matrix-js-sdk/src/models/typed-event-emitter"; import { User } from "matrix-js-sdk/src/models/user"; import { Mocked } from "jest-mock"; -import { VerificationBase } from "matrix-js-sdk/src/crypto/verification/Base"; import { EmojiMapping, ShowSasCallbacks, + Verifier, VerifierEvent, VerifierEventHandlerMap, } from "matrix-js-sdk/src/crypto-api/verification"; @@ -94,13 +94,13 @@ describe("", () => { }); describe("'Verify by emoji' flow", () => { - let mockVerifier: Mocked; + let mockVerifier: Mocked; let mockRequest: Mocked; beforeEach(() => { mockVerifier = makeMockVerifier(); mockRequest = makeMockVerificationRequest({ - verifier: mockVerifier, + verifier: mockVerifier as unknown as VerificationRequest["verifier"], chosenMethod: "m.sas.v1", }); }); @@ -158,7 +158,7 @@ function makeMockVerificationRequest(props: Partial = {}): return request as unknown as Mocked; } -function makeMockVerifier(): Mocked { +function makeMockVerifier(): Mocked { const verifier = new TypedEventEmitter(); Object.assign(verifier, { cancel: jest.fn(), @@ -166,7 +166,7 @@ function makeMockVerifier(): Mocked { getShowSasCallbacks: jest.fn(), getReciprocateQrCodeCallbacks: jest.fn(), }); - return verifier as unknown as Mocked; + return verifier as unknown as Mocked; } function makeMockSasCallbacks(): ShowSasCallbacks {