Complete platform management workflows
This commit is contained in:
@@ -2,6 +2,7 @@ import { renderToStaticMarkup } from "react-dom/server";
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { HomePage } from "./HomePage";
|
||||
import { MaintenancePage } from "./MaintenancePage";
|
||||
import { PluginsPage } from "./PluginsPage";
|
||||
import { ProfileSettingsPage } from "./ProfileSettingsPage";
|
||||
import { ServerDetailPage } from "./ServerDetailPage";
|
||||
@@ -10,6 +11,7 @@ import { UsersPage } from "./UsersPage";
|
||||
import type { PageComponentProps } from "../contracts/page";
|
||||
import { capabilitiesForRoles, type CurrentUserView } from "../contracts/workspace";
|
||||
import type { OperationTracker } from "../stores/operations";
|
||||
import type { UserResponse } from "../api/types";
|
||||
|
||||
const adminUser: CurrentUserView = {
|
||||
id: "user-admin",
|
||||
@@ -30,6 +32,17 @@ const noopOperations: OperationTracker = {
|
||||
isPending: () => false
|
||||
};
|
||||
|
||||
const reviewUser: UserResponse = {
|
||||
id: "user-reviewer",
|
||||
displayName: "Plugin Reviewer",
|
||||
email: "reviewer@example.test",
|
||||
status: "pending",
|
||||
roles: ["server-admin"],
|
||||
profile: { contactNote: "needs approval" },
|
||||
createdAt: "2026-07-03T00:00:00Z",
|
||||
updatedAt: "2026-07-03T00:00:00Z"
|
||||
};
|
||||
|
||||
function pageProps(params: PageComponentProps["params"] = {}): PageComponentProps {
|
||||
return {
|
||||
session: adminUser,
|
||||
@@ -86,11 +99,22 @@ describe("first-party console pages", () => {
|
||||
});
|
||||
|
||||
it("renders user access review context", () => {
|
||||
const html = renderToStaticMarkup(<UsersPage {...pageProps()} />);
|
||||
const html = renderToStaticMarkup(<UsersPage {...pageProps()} initialState={{ users: [reviewUser], loading: false, source: "local-development" }} />);
|
||||
|
||||
expect(html).toContain("用户管理");
|
||||
expect(html).toContain("Plugin Reviewer");
|
||||
expect(html).toContain("needs approval");
|
||||
expect(html).toContain("本地开发样例 / 禁止假成功");
|
||||
});
|
||||
|
||||
it("renders maintenance triage entry points", () => {
|
||||
const html = renderToStaticMarkup(<MaintenancePage {...pageProps()} />);
|
||||
|
||||
expect(html).toContain("系统维护");
|
||||
expect(html).toContain("维护排障入口");
|
||||
expect(html).toContain("节点详情");
|
||||
expect(html).toContain("最近失败任务");
|
||||
expect(html).toContain("审计异常");
|
||||
});
|
||||
|
||||
it("renders profile settings as a full page", () => {
|
||||
|
||||
Reference in New Issue
Block a user