Refresh HiveGrid Cloud reference snapshot
This commit is contained in:
1 parent
5e99e14772
commit
7f88026f79
5955 files changed
+1177325
-188362
No files matched your search
@@ -6,10 +6,30 @@ vi.mock("~/utils/session.server", () => ({
|
||||
logout: vi.fn(async () => new Response(null, { status: 302 })),
|
||||
validateCSRFToken: vi.fn(),
|
||||
}));
|
||||
vi.mock("~/utils/app/HostRouting.server", () => ({ getHostRoutingContextFromRequest: vi.fn() }));
|
||||
|
||||
import { loader } from "./logout";
|
||||
import { getHostRoutingContextFromRequest } from "~/utils/app/HostRouting.server";
|
||||
import { getUserInfo, logout, validateCSRFToken } from "~/utils/session.server";
|
||||
import { action, loader } from "./logout";
|
||||
|
||||
describe("logout route", () => {
|
||||
it("keeps admin logout on POST and forwards it to the Authentik-aware endpoint", async () => {
|
||||
vi.mocked(getHostRoutingContextFromRequest).mockReturnValueOnce("admin");
|
||||
const request = new Request("https://admin.example.test/logout", {
|
||||
method: "POST",
|
||||
body: new URLSearchParams({ csrf: "csrf-token" }),
|
||||
});
|
||||
|
||||
const response = await action({ request, params: {}, context: {} } as never);
|
||||
|
||||
expect(response.status).toBe(307);
|
||||
expect(response.headers.get("Location")).toBe("/auth/admin/logout");
|
||||
expect(response.headers.get("Cache-Control")).toBe("no-store");
|
||||
expect(validateCSRFToken).toHaveBeenCalledWith(request);
|
||||
expect(getUserInfo).not.toHaveBeenCalled();
|
||||
expect(logout).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("redirects GET requests to the canonical app host root", async () => {
|
||||
try {
|
||||
vi.stubEnv("APP_BASE_DOMAIN", "example.test");
|
||||
|
||||
Reference in new issue
Block a user