Track HiveGrid Cloud planning reference
This commit is contained in:
1 parent
b3d5ea6764
commit
e341c5938a
5784 files changed
+1104929
-3
No files matched your search
@@ -0,0 +1,35 @@
|
||||
import "@testing-library/jest-dom";
|
||||
import { render, screen } from "@testing-library/react";
|
||||
import { MemoryRouter } from "react-router";
|
||||
import { describe, expect, it, vi } from "vitest";
|
||||
|
||||
import * as TotpRoute from "./auth.totp";
|
||||
|
||||
vi.mock("i18next", () => ({
|
||||
t: (key: string) =>
|
||||
({
|
||||
"auth:totp.title": "Authenticator challenge",
|
||||
"auth:totp.description": "Use the admin MFA challenge to complete sign-in.",
|
||||
"account.forgot.backToLogin": "Back to login",
|
||||
})[key] ?? key,
|
||||
}));
|
||||
|
||||
describe("auth TOTP route", () => {
|
||||
it("renders only the no-secret placeholder and login link", () => {
|
||||
render(
|
||||
<MemoryRouter>
|
||||
<TotpRoute.default />
|
||||
</MemoryRouter>
|
||||
);
|
||||
|
||||
expect(screen.getByRole("heading", { name: "Authenticator challenge" })).toBeInTheDocument();
|
||||
expect(screen.getByText("Use the admin MFA challenge to complete sign-in.")).toBeInTheDocument();
|
||||
expect(screen.getByRole("link", { name: "Back to login" })).toHaveAttribute("href", "/login");
|
||||
expect(document.body.textContent).not.toMatch(/secret|otpauth|recovery code|encrypted/i);
|
||||
});
|
||||
|
||||
it("does not expose loader or action handlers for token or method input", () => {
|
||||
expect("loader" in TotpRoute).toBe(false);
|
||||
expect("action" in TotpRoute).toBe(false);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user