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,31 @@
|
||||
import { describe, expect, it, vi } from "vitest";
|
||||
|
||||
vi.mock("~/utils/db/logs.db.server", () => ({ createLogLogout: vi.fn() }));
|
||||
vi.mock("~/utils/session.server", () => ({
|
||||
getUserInfo: vi.fn(async () => ({ userId: null })),
|
||||
logout: vi.fn(async () => new Response(null, { status: 302 })),
|
||||
validateCSRFToken: vi.fn(),
|
||||
}));
|
||||
|
||||
import { loader } from "./logout";
|
||||
|
||||
describe("logout route", () => {
|
||||
it("redirects GET requests to the canonical app host root", async () => {
|
||||
try {
|
||||
vi.stubEnv("APP_BASE_DOMAIN", "example.test");
|
||||
vi.stubEnv("WEB_APP_HOST", "app.example.test");
|
||||
vi.stubEnv("ADMIN_APP_HOST", "admin.example.test");
|
||||
vi.stubEnv("APP_PROTOCOL", "https");
|
||||
|
||||
await loader();
|
||||
} catch (error) {
|
||||
expect(error).toBeInstanceOf(Response);
|
||||
expect((error as Response).headers.get("Location")).toBe("https://app.example.test/");
|
||||
return;
|
||||
} finally {
|
||||
vi.unstubAllEnvs();
|
||||
}
|
||||
|
||||
throw new Error("Expected redirect response");
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user