test(auth): retarget the MFA route mocks at the shared gate

The three unit suites that stubbed `requireCookieAuth` / `requireFreshMfa`
directly now stub `requireMfaManagementAuth`, and the password-change suite
stubs the elevation revocation the route gained. Adds the unit checks that need
no database: the elevation TTL is pinned to the cookie path's step-up window so
the two cannot drift apart, the minted value is a prefixed CSPRNG secret whose
plaintext never reaches the row, and a value carrying another credential's
prefix is refused without costing a query.
This commit is contained in:
Marc-André Bombeck committed 2026-07-19 13:14:38 +02:00
1 parent 433d983e60
commit ba45a25cb0
5 files changed
+132 -8

No files matched your search

@@ -24,6 +24,12 @@ vi.mock("@/lib/db", () => ({
},
}));
// v1.30.34 — the route drops the account's step-up elevations alongside its
// sessions, so the rotation cannot leave a proof of the old credential standing.
vi.mock("@/lib/auth/step-up", () => ({
revokeStepUpElevations: vi.fn().mockResolvedValue(undefined),
}));
vi.mock("@/lib/auth/session", () => ({
getSession: vi.fn(),
destroyAllSessions: vi.fn().mockResolvedValue(undefined),