Skip to content

Commit

Permalink
Rename and remove tests
Browse files Browse the repository at this point in the history
  • Loading branch information
florianduros committed Oct 25, 2024
1 parent 2461c03 commit 5bdc161
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 146 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import React from "react";
import { mocked, MockedObject } from "jest-mock";
import { MatrixClient, MatrixError } from "matrix-js-sdk/src/matrix";
import { sleep } from "matrix-js-sdk/src/utils";
import { KeyBackupInfo } from "matrix-js-sdk/src/crypto-api";
import { waitFor } from "@testing-library/dom";

import { filterConsole, flushPromises, stubClient } from "../../../../../test-utils";
Expand Down Expand Up @@ -49,7 +48,7 @@ describe("CreateSecretStorageDialog", () => {
await flushPromises();
});

it("show the standard path", async () => {
it("handles the happy path", async () => {
const result = renderComponent();
await result.findByText(
"Safeguard against losing access to encrypted messages & data by backing up encryption keys on your server.",
Expand Down Expand Up @@ -103,18 +102,4 @@ describe("CreateSecretStorageDialog", () => {
expect(result.container).toMatchSnapshot();
});
});

describe("when backup is present but not trusted", () => {
beforeEach(() => {
mockClient.getKeyBackupVersion.mockResolvedValue({} as KeyBackupInfo);
});

it("shows key passphrase change", async () => {
const result = renderComponent();
await screen.findByText(
"Safeguard against losing access to encrypted messages & data by backing up encryption keys on your server.",
);
expect(result.container).toMatchSnapshot();
});
});
});
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`CreateSecretStorageDialog show the standard path 1`] = `
exports[`CreateSecretStorageDialog handles the happy path 1`] = `
<div>
<div
data-focus-guard="true"
Expand Down Expand Up @@ -128,7 +128,7 @@ exports[`CreateSecretStorageDialog show the standard path 1`] = `
</div>
`;

exports[`CreateSecretStorageDialog show the standard path 2`] = `
exports[`CreateSecretStorageDialog handles the happy path 2`] = `
<div>
<div
data-focus-guard="true"
Expand Down Expand Up @@ -257,134 +257,6 @@ exports[`CreateSecretStorageDialog shows a loading spinner initially 1`] = `
</div>
`;

exports[`CreateSecretStorageDialog when backup is present but not trusted shows key passphrase change 1`] = `
<div>
<div
data-focus-guard="true"
style="width: 1px; height: 0px; padding: 0px; overflow: hidden; position: fixed; top: 1px; left: 1px;"
tabindex="0"
/>
<div
aria-labelledby="mx_BaseDialog_title"
class="mx_CreateSecretStorageDialog"
data-focus-lock-disabled="false"
role="dialog"
>
<div
class="mx_Dialog_header"
>
<h1
class="mx_Heading_h3 mx_Dialog_title mx_CreateSecretStorageDialog_centeredTitle"
id="mx_BaseDialog_title"
>
Set up Secure Backup
</h1>
</div>
<div>
<form>
<p
class="mx_CreateSecretStorageDialog_centeredBody"
>
Safeguard against losing access to encrypted messages & data by backing up encryption keys on your server.
</p>
<div
class="mx_CreateSecretStorageDialog_primaryContainer"
role="radiogroup"
>
<label
class="mx_StyledRadioButton mx_StyledRadioButton_enabled mx_StyledRadioButton_checked mx_StyledRadioButton_outlined"
>
<input
checked=""
name="keyPassphrase"
type="radio"
value="key"
/>
<div>
<div />
</div>
<div
class="mx_StyledRadioButton_content"
>
<div
class="mx_CreateSecretStorageDialog_optionTitle"
>
<span
class="mx_CreateSecretStorageDialog_optionIcon mx_CreateSecretStorageDialog_optionIcon_secureBackup"
/>
Generate a Security Key
</div>
<div>
We'll generate a Security Key for you to store somewhere safe, like a password manager or a safe.
</div>
</div>
<div
class="mx_StyledRadioButton_spacer"
/>
</label>
<label
class="mx_StyledRadioButton mx_StyledRadioButton_enabled mx_StyledRadioButton_outlined"
>
<input
name="keyPassphrase"
type="radio"
value="passphrase"
/>
<div>
<div />
</div>
<div
class="mx_StyledRadioButton_content"
>
<div
class="mx_CreateSecretStorageDialog_optionTitle"
>
<span
class="mx_CreateSecretStorageDialog_optionIcon mx_CreateSecretStorageDialog_optionIcon_securePhrase"
/>
Enter a Security Phrase
</div>
<div>
Use a secret phrase only you know, and optionally save a Security Key to use for backup.
</div>
</div>
<div
class="mx_StyledRadioButton_spacer"
/>
</label>
</div>
<div
class="mx_Dialog_buttons"
>
<span
class="mx_Dialog_buttons_row"
>
<button
data-testid="dialog-cancel-button"
type="button"
>
Cancel
</button>
<button
class="mx_Dialog_primary"
data-testid="dialog-primary-button"
type="button"
>
Continue
</button>
</span>
</div>
</form>
</div>
</div>
<div
data-focus-guard="true"
style="width: 1px; height: 0px; padding: 0px; overflow: hidden; position: fixed; top: 1px; left: 1px;"
tabindex="0"
/>
</div>
`;

exports[`CreateSecretStorageDialog when there is an error fetching the backup version shows an error 1`] = `
<div>
<div
Expand Down

0 comments on commit 5bdc161

Please sign in to comment.