feat: complete MVP foundation auth and dashboard

This commit is contained in:
2026-06-04 09:05:40 +02:00
parent 20615e12a1
commit df7a955736
32 changed files with 880 additions and 139 deletions

26
tests/proxy-auth.test.ts Normal file
View File

@@ -0,0 +1,26 @@
import assert from "node:assert/strict";
import test from "node:test";
import { shouldRedirectDashboardRequest } from "../lib/proxy-auth";
test("shouldRedirectDashboardRequest protects dashboard paths without a valid mock cookie", () => {
assert.equal(
shouldRedirectDashboardRequest("/dashboard", undefined),
true,
);
assert.equal(
shouldRedirectDashboardRequest("/dashboard/leads", "wrong"),
true,
);
});
test("shouldRedirectDashboardRequest allows valid mock sessions and non-dashboard paths", () => {
assert.equal(
shouldRedirectDashboardRequest(
"/dashboard",
"mock-admin",
),
false,
);
assert.equal(shouldRedirectDashboardRequest("/audit/example", undefined), false);
});