Files
HiveGrid-Wireframes/03 Quellen und Referenzen/hivegrid-cloud/apps/web/app/routes/admin.login.test.ts
T
2026-07-08 16:15:37 +02:00

30 lines
870 B
TypeScript

import { describe, expect, it } from "vitest";
import { loader } from "./admin.login";
function expectRedirect(call: () => Response): Response {
try {
call();
} catch (error) {
if (typeof error === "object" && error !== null && "status" in error && "headers" in error) {
return error as Response;
}
throw error;
}
throw new Error("Expected redirect response");
}
describe("admin login alias route", () => {
it("redirects legacy /admin/login URLs to the canonical login route", async () => {
const response = expectRedirect(() =>
loader({
request: new Request("https://admin.example.test/admin/login?error=sso_state_invalid"),
params: {},
context: {},
})
);
expect(response.status).toBe(302);
expect(response.headers.get("Location")).toBe("/login?error=sso_state_invalid");
});
});