* Make the encryption card more configurable: - Change the icon - Can set the destructive props * Update compound * Add advanced section * Add the `Never send encrypted messages to unverified devices` settings * - Add commercial license - Remove generic type * Rename EncryptionDetails css classes * Use same uiAuthCallback * Use h3 for title * Add tests to `AdvancedPanel` * Add tests to `EncryptionUserSettingsTab` * Add tests to `ResetIdentityPanel` * Get only the recovery section in recovery tests * Add e2e test
38 lines
1.3 KiB
TypeScript
38 lines
1.3 KiB
TypeScript
/*
|
|
* Copyright 2025 New Vector Ltd.
|
|
*
|
|
* SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Commercial
|
|
* Please see LICENSE files in the repository root for full details.
|
|
*/
|
|
|
|
import React from "react";
|
|
import { MatrixClient } from "matrix-js-sdk/src/matrix";
|
|
import { render, screen } from "jest-matrix-react";
|
|
import userEvent from "@testing-library/user-event";
|
|
|
|
import { ResetIdentityPanel } from "../../../../../../src/components/views/settings/encryption/ResetIdentityPanel";
|
|
import { createTestClient, withClientContextRenderOptions } from "../../../../../test-utils";
|
|
|
|
describe("<ResetIdentityPanel />", () => {
|
|
let matrixClient: MatrixClient;
|
|
|
|
beforeEach(() => {
|
|
matrixClient = createTestClient();
|
|
});
|
|
|
|
it("should reset the encryption when the continue button is clicked", async () => {
|
|
const user = userEvent.setup();
|
|
|
|
const onFinish = jest.fn();
|
|
const { asFragment } = render(
|
|
<ResetIdentityPanel onFinish={onFinish} onCancelClick={jest.fn()} />,
|
|
withClientContextRenderOptions(matrixClient),
|
|
);
|
|
expect(asFragment()).toMatchSnapshot();
|
|
|
|
await user.click(screen.getByRole("button", { name: "Continue" }));
|
|
expect(matrixClient.getCrypto()!.resetEncryption).toHaveBeenCalled();
|
|
expect(onFinish).toHaveBeenCalled();
|
|
});
|
|
});
|