Reorganize repo structure and standards references
This commit is contained in:
1 parent
3cb93a81be
commit
be2054274d
5885 files changed
+2588
-195
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