fix: expose payment admin navigation
Deploy staging to test server / deploy (push) Successful in 2m59s

This commit is contained in:
linmeng
2026-07-29 13:13:47 +08:00
parent 9184ea294d
commit 43c8b59c24
3 changed files with 28 additions and 1 deletions
+8
View File
@@ -13,6 +13,7 @@ const codesRoute = readFileSync(new URL("../src/app/api/admin/codes/route.ts", i
const codeRoute = readFileSync(new URL("../src/app/api/admin/codes/[id]/route.ts", import.meta.url), "utf8");
const providers = readFileSync(new URL("../src/lib/admin/providers.ts", import.meta.url), "utf8");
const adminLayout = readFileSync(new URL("../src/app/admin/layout.tsx", import.meta.url), "utf8");
const adminApp = readFileSync(new URL("../src/components/admin/admin-app.tsx", import.meta.url), "utf8");
const adminRootRoute = readFileSync(new URL("../src/app/admin/route.ts", import.meta.url), "utf8");
const readonlyRoutes = ["users", "credit-transactions", "consultations", "audit-logs"].map((resource) =>
readFileSync(new URL(`../src/app/api/admin/${resource}/route.ts`, import.meta.url), "utf8"),
@@ -43,6 +44,13 @@ test("self-hosted account entry checks only the persisted admin role", () => {
assert.match(auth, /authorizeAdminAccess\(user, access\)/);
});
test("admin navigation exposes payment records and payment configuration", () => {
assert.match(adminApp, /name: "payments", list: "\/admin\/payments", meta: \{ label: "支付记录"/);
assert.match(adminApp, /name: "packages", list: "\/admin\/packages", meta: \{ label: "支付配置"/);
assert.match(adminApp, /CreditCardOutlined/);
assert.match(adminApp, /SettingOutlined/);
});
test("admin pages and root route are server-gated before rendering or redirecting", () => {
assert.match(adminLayout, /await requireAdminSession\("read"\)/);
assert.match(adminLayout, /error\.status === 401 \? "\/login" : "\/"/);