Remove references to VerificationRequest
(#11050)
* Update references to `VerificationRequestEvent` * Update references to `Phase` * update references to legacy `PHASE_*` constants * Replace `request.canAccept` with `canAcceptVerificationRequest` * Replace `VerificationRequest` with the interface throughout * Minor strict type fixes * Add a couple of tests
This commit is contained in:
parent
6486255f54
commit
b9b93264b6
20 changed files with 72 additions and 57 deletions
|
@ -18,10 +18,8 @@ import React from "react";
|
|||
import { render, within } from "@testing-library/react";
|
||||
import { EventEmitter } from "events";
|
||||
import { MatrixEvent } from "matrix-js-sdk/src/matrix";
|
||||
import {
|
||||
Phase as VerificationPhase,
|
||||
VerificationRequest,
|
||||
} from "matrix-js-sdk/src/crypto/verification/request/VerificationRequest";
|
||||
import { VerificationPhase } from "matrix-js-sdk/src/crypto-api/verification";
|
||||
import { VerificationRequest } from "matrix-js-sdk/src/crypto/verification/request/VerificationRequest";
|
||||
|
||||
import { MatrixClientPeg } from "../../../../src/MatrixClientPeg";
|
||||
import { getMockClientWithEventEmitter, mockClientMethodsUser } from "../../../test-utils";
|
||||
|
@ -85,6 +83,18 @@ describe("MKeyVerificationRequest", () => {
|
|||
expect(within(container).getByRole("button")).toHaveTextContent("@other:user accepted");
|
||||
});
|
||||
|
||||
it("should render appropriately when the request was initiated by the other user and has not yet been accepted", () => {
|
||||
const event = new MatrixEvent({ type: "m.key.verification.request" });
|
||||
event.verificationRequest = getMockVerificationRequest({
|
||||
phase: VerificationPhase.Requested,
|
||||
initiatedByMe: false,
|
||||
otherUserId: "@other:user",
|
||||
});
|
||||
const result = render(<MKeyVerificationRequest mxEvent={event} />);
|
||||
expect(result.container).toHaveTextContent("@other:user wants to verify");
|
||||
result.getByRole("button", { name: "Accept" });
|
||||
});
|
||||
|
||||
it("should render appropriately when the request was initiated by the other user and has been accepted", () => {
|
||||
const event = new MatrixEvent({ type: "m.key.verification.request" });
|
||||
event.verificationRequest = getMockVerificationRequest({
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue