Update portal dependencies for security advisories
This commit is contained in:
1 parent
69264ce165
commit
f899417b1e
6 files changed
+703
-743
No files matched your search
@@ -116,10 +116,21 @@ test("server-rendered login and reset forms use POST for native submissions", as
|
||||
|
||||
test("the enrollment confirmation code form uses POST", async () => {
|
||||
const { TwoFactorWizard } = await import("@/app/zwei-faktor/wizard");
|
||||
enableTwoFactor.mockResolvedValueOnce({ data: { totpURI: "otpauth://totp/dummy?secret=DUMMY", backupCodes: [] } });
|
||||
enableTwoFactor.mockResolvedValueOnce({ data: { method: "totp", totpURI: "otpauth://totp/dummy?secret=DUMMY", backupCodes: [] } });
|
||||
render(<TwoFactorWizard initiallyEnabled={false} />);
|
||||
fireEvent.submit(screen.getByRole("button", { name: "Einrichtung starten" }).closest("form")!);
|
||||
expect(enableTwoFactor).toHaveBeenCalledWith({ password: "", method: "totp" });
|
||||
const field = await screen.findByLabelText<HTMLInputElement>("Code aus der App");
|
||||
expect(field.form?.method).toBe("post");
|
||||
expect([...new FormData(field.form!).keys()]).toEqual([]);
|
||||
});
|
||||
|
||||
test("reports a non-TOTP setup response and leaves enrollment retryable", async () => {
|
||||
const { TwoFactorWizard } = await import("@/app/zwei-faktor/wizard");
|
||||
enableTwoFactor.mockResolvedValueOnce({ data: { method: "otp" } });
|
||||
render(<TwoFactorWizard initiallyEnabled={false} />);
|
||||
const button = screen.getByRole("button", { name: "Einrichtung starten" });
|
||||
fireEvent.submit(button.closest("form")!);
|
||||
expect((await screen.findByRole("alert")).textContent).toMatch(/fehlgeschlagen/i);
|
||||
expect((screen.getByRole("button", { name: "Einrichtung starten" }) as HTMLButtonElement).disabled).toBe(false);
|
||||
});
|
||||
Reference in new issue
Block a user