diff --git a/web/src/components/core/InstallationFinished.test.jsx b/web/src/components/core/InstallationFinished.test.jsx index 0b8dd93ec3..f34998ffb3 100644 --- a/web/src/components/core/InstallationFinished.test.jsx +++ b/web/src/components/core/InstallationFinished.test.jsx @@ -31,18 +31,22 @@ jest.mock("~/client"); jest.mock("~/components/core/Sidebar", () => () =>
Agama sidebar
); const finishInstallationFn = jest.fn(); - -const storageSettings = { encryptionMethod: "luks2" }; +let encryptionMethod; describe("InstallationFinished", () => { beforeEach(() => { + encryptionMethod = "luks2"; createClient.mockImplementation(() => { return { manager: { finishInstallation: finishInstallationFn, useIguana: () => Promise.resolve(false) }, - storage: { proposal: { getResult: jest.fn().mockResolvedValue({ settings: storageSettings }) } } + storage: { + proposal: { + getResult: jest.fn().mockResolvedValue({ settings: { encryptionMethod } }) + }, + } }; }); }); @@ -63,4 +67,22 @@ describe("InstallationFinished", () => { await user.click(rebootButton); expect(finishInstallationFn).toHaveBeenCalled(); }); + + describe("when TPM was set to decrypt automatically on each boot", () => { + beforeEach(() => { + encryptionMethod = "tpm_fde"; + }); + + it("shows the TPM reminder", async () => { + installerRender(); + await screen.findAllByText(/TPM/); + }); + }); + + describe("when TPM was not set to decrypt automatically on each boot", () => { + it("does not show the TPM reminder", () => { + installerRender(); + expect(screen.queryByText(/TPM/)).toBeNull(); + }); + }); });