fix: expose payment admin navigation
Deploy staging to test server / deploy (push) Successful in 2m59s
Deploy staging to test server / deploy (push) Successful in 2m59s
This commit is contained in:
@@ -2,8 +2,10 @@
|
||||
|
||||
import {
|
||||
AuditOutlined,
|
||||
CreditCardOutlined,
|
||||
GiftOutlined,
|
||||
MessageOutlined,
|
||||
SettingOutlined,
|
||||
TeamOutlined,
|
||||
TransactionOutlined,
|
||||
} from "@ant-design/icons";
|
||||
@@ -32,6 +34,8 @@ export function AdminApp({ children }: { children: ReactNode }) {
|
||||
notificationProvider={notificationProvider}
|
||||
resources={[
|
||||
{ name: "codes", list: "/admin/codes", meta: { label: "兑换码", icon: <GiftOutlined /> } },
|
||||
{ name: "payments", list: "/admin/payments", meta: { label: "支付记录", icon: <CreditCardOutlined /> } },
|
||||
{ name: "packages", list: "/admin/packages", meta: { label: "支付配置", icon: <SettingOutlined /> } },
|
||||
{ name: "users", list: "/admin/codes?resource=users", meta: { label: "用户资料", icon: <TeamOutlined /> } },
|
||||
{ name: "credit-transactions", list: "/admin/codes?resource=credit-transactions", meta: { label: "积分流水", icon: <TransactionOutlined /> } },
|
||||
{ name: "consultations", list: "/admin/codes?resource=consultations", meta: { label: "咨询请求", icon: <MessageOutlined /> } },
|
||||
|
||||
@@ -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" : "\/"/);
|
||||
|
||||
Reference in New Issue
Block a user