Tidy SetupEncryptionToast tests (#29887)

* Remove extraneous 'await' from SetupEncryptionToast

* Group SetupEncryptionToast tests
This commit is contained in:
Andy Balaam
2025-05-06 15:39:11 +01:00
committed by GitHub
parent a728385385
commit 64f0dfe0bc

View File

@@ -26,13 +26,14 @@ describe("SetupEncryptionToast", () => {
render(<ToastContainer />);
});
it("should render the 'set up recovery' toast", async () => {
describe("Set up recovery", () => {
it("should render the toast", async () => {
showToast(Kind.SET_UP_RECOVERY);
await expect(await screen.findByRole("heading", { name: "Set up recovery" })).toBeInTheDocument();
expect(await screen.findByRole("heading", { name: "Set up recovery" })).toBeInTheDocument();
});
it("should dismiss toast when 'not now' button clicked", async () => {
it("should dismiss the toast when 'not now' button clicked", async () => {
jest.spyOn(DeviceListener.sharedInstance(), "dismissEncryptionSetup");
showToast(Kind.SET_UP_RECOVERY);
@@ -42,8 +43,10 @@ describe("SetupEncryptionToast", () => {
expect(DeviceListener.sharedInstance().dismissEncryptionSetup).toHaveBeenCalled();
});
});
it("should render the 'key storage out of sync' toast", async () => {
describe("Key storage out of sync", () => {
it("should render the toast", async () => {
showToast(Kind.KEY_STORAGE_OUT_OF_SYNC);
await expect(screen.findByText("Your key storage is out of sync.")).resolves.toBeInTheDocument();
@@ -78,4 +81,5 @@ describe("SetupEncryptionToast", () => {
props: { initialEncryptionState: "reset_identity_forgot" },
});
});
});
});