Skip to content

Commit

Permalink
Iterate
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Telatynski <[email protected]>
  • Loading branch information
t3chguy committed Oct 21, 2024
1 parent 483c0d3 commit 2ef8a49
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 62 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,18 @@ describe("ExportE2eKeysDialog", () => {
it("renders", () => {
const cli = createTestClient();
const onFinished = jest.fn();
const { asFragment } = render(<ExportE2eKeysDialog matrixClient={cli} onFinished={onFinished} />);
const { asFragment } = render(<ExportE2eKeysDialog matrixClient={cli} onFinished={onFinished} />, {
legacyRoot: true,
});
expect(asFragment()).toMatchSnapshot();
});

it("should have disabled submit button initially", () => {
const cli = createTestClient();
const onFinished = jest.fn();
const { container } = render(<ExportE2eKeysDialog matrixClient={cli} onFinished={onFinished} />);
const { container } = render(<ExportE2eKeysDialog matrixClient={cli} onFinished={onFinished} />, {
legacyRoot: true,
});
fireEvent.click(container.querySelector("[type=submit]")!);
expect(screen.getByText("Enter passphrase")).toBeInTheDocument();
});
Expand All @@ -35,7 +39,7 @@ describe("ExportE2eKeysDialog", () => {
const cli = createTestClient();
const onFinished = jest.fn();

render(<ExportE2eKeysDialog matrixClient={cli} onFinished={onFinished} />);
render(<ExportE2eKeysDialog matrixClient={cli} onFinished={onFinished} />, { legacyRoot: true });
const input = screen.getByLabelText("Enter passphrase");
await userEvent.type(input, "password");
await expect(screen.findByText("This is a top-10 common password")).resolves.toBeInTheDocument();
Expand All @@ -45,7 +49,9 @@ describe("ExportE2eKeysDialog", () => {
const cli = createTestClient();
const onFinished = jest.fn();

const { container } = render(<ExportE2eKeysDialog matrixClient={cli} onFinished={onFinished} />);
const { container } = render(<ExportE2eKeysDialog matrixClient={cli} onFinished={onFinished} />, {
legacyRoot: true,
});
await userEvent.type(screen.getByLabelText("Enter passphrase"), "ThisIsAMoreSecurePW123$$");
await userEvent.type(screen.getByLabelText("Confirm passphrase"), "ThisIsAMoreSecurePW124$$");
fireEvent.click(container.querySelector("[type=submit]")!);
Expand All @@ -70,7 +76,9 @@ describe("ExportE2eKeysDialog", () => {
jest.spyOn(MegolmExportEncryption, "encryptMegolmKeyFile").mockResolvedValue(new ArrayBuffer(3));

// When we tell the dialog to export
const { container } = render(<ExportE2eKeysDialog matrixClient={cli} onFinished={jest.fn()} />);
const { container } = render(<ExportE2eKeysDialog matrixClient={cli} onFinished={jest.fn()} />, {
legacyRoot: true,
});
await userEvent.type(screen.getByLabelText("Enter passphrase"), passphrase);
await userEvent.type(screen.getByLabelText("Confirm passphrase"), passphrase);
fireEvent.click(container.querySelector("[type=submit]")!);
Expand Down
Loading

0 comments on commit 2ef8a49

Please sign in to comment.