|
|
@@ -0,0 +1,517 @@
|
|
|
+/**
|
|
|
+ * 各清单页:行源为空时必须出诚实空态(⛔ 白屏、⛔ 把空集渲染成取数失败)。
|
|
|
+ * 数据一律 mock 成「成功且 0 行」,断言页面原文与错误横幅互斥。
|
|
|
+ */
|
|
|
+import type { ReactElement } from "react";
|
|
|
+import { cleanup, render, screen, waitFor } from "@testing-library/react";
|
|
|
+import { MemoryRouter, Route, Routes } from "react-router";
|
|
|
+import { afterEach, beforeEach, expect, it, vi } from "vitest";
|
|
|
+import type { OrganizationData } from "../../lib/organization-demo";
|
|
|
+import { VIEW_LIST_EMPTY } from "../../lib/copy-views";
|
|
|
+import { W15 } from "../../lib/copy-jobs";
|
|
|
+
|
|
|
+vi.hoisted(() => {
|
|
|
+ (globalThis as { __SEO_CTX__?: { tenant_id: string; project_id: string; env: string; stage: string } }).__SEO_CTX__ = {
|
|
|
+ tenant_id: "",
|
|
|
+ project_id: "",
|
|
|
+ env: "nonprod",
|
|
|
+ stage: "dev",
|
|
|
+ };
|
|
|
+});
|
|
|
+
|
|
|
+const identity = vi.hoisted(() => ({
|
|
|
+ current: {
|
|
|
+ id: "admin-lin",
|
|
|
+ name: "林管",
|
|
|
+ role: "admin" as string,
|
|
|
+ group: "operations" as string,
|
|
|
+ title: "总运营",
|
|
|
+ login: "admin",
|
|
|
+ scope: "全部",
|
|
|
+ primary: true,
|
|
|
+ customerNo: "C-EMPTY",
|
|
|
+ maintenanceTeamId: "MT-EMPTY",
|
|
|
+ },
|
|
|
+}));
|
|
|
+
|
|
|
+const EMPTY_ORG: OrganizationData = {
|
|
|
+ regions: [],
|
|
|
+ operators: [],
|
|
|
+ partners: [],
|
|
|
+ operationsTeams: [],
|
|
|
+ maintenanceTeams: [],
|
|
|
+ enterprises: [],
|
|
|
+};
|
|
|
+
|
|
|
+function load<T>(data: T) {
|
|
|
+ return { data, error: null, loading: false, reload: () => {}, reloadAsync: async () => {} };
|
|
|
+}
|
|
|
+
|
|
|
+class ResizeObserverStub {
|
|
|
+ observe() {}
|
|
|
+ unobserve() {}
|
|
|
+ disconnect() {}
|
|
|
+}
|
|
|
+vi.stubGlobal("ResizeObserver", ResizeObserverStub);
|
|
|
+if (!window.matchMedia) {
|
|
|
+ vi.stubGlobal("matchMedia", (query: string) => ({
|
|
|
+ matches: false,
|
|
|
+ media: query,
|
|
|
+ onchange: null,
|
|
|
+ addEventListener() {},
|
|
|
+ removeEventListener() {},
|
|
|
+ addListener() {},
|
|
|
+ removeListener() {},
|
|
|
+ dispatchEvent: () => false,
|
|
|
+ }));
|
|
|
+}
|
|
|
+vi.stubGlobal("requestIdleCallback", (cb: () => void) => {
|
|
|
+ cb();
|
|
|
+ return 1;
|
|
|
+});
|
|
|
+vi.stubGlobal("cancelIdleCallback", () => {});
|
|
|
+
|
|
|
+vi.mock("../../auth/session", () => ({
|
|
|
+ useSession: () => ({ ctx: { role_code: "admin" } }),
|
|
|
+}));
|
|
|
+vi.mock("../../lib/demo-session", () => ({
|
|
|
+ useDemoIdentity: () => identity.current,
|
|
|
+}));
|
|
|
+vi.mock("../../lib/use-horizontal-overflow", () => ({
|
|
|
+ useHorizontalOverflow: () => ({ ref: { current: null }, width: 1440, overflow: false, canScrollLeft: false, canScrollRight: false }),
|
|
|
+}));
|
|
|
+vi.mock("../../components/layout/ProfileOverlay", () => ({
|
|
|
+ useProfileOverlay: () => ({ isOpen: false, openProfile: () => {}, closeProfile: () => {} }),
|
|
|
+}));
|
|
|
+vi.mock("../../lib/customer-records", () => ({ readCustomers: () => [] }));
|
|
|
+vi.mock("../../lib/work-order-store", () => ({ readWorkOrders: () => [] }));
|
|
|
+
|
|
|
+vi.mock("../../lib/organization-demo", async (loadMod) => ({
|
|
|
+ ...await loadMod<typeof import("../../lib/organization-demo")>(),
|
|
|
+ useOrganizationData: () => EMPTY_ORG,
|
|
|
+ useOrganizationSnapshot: () => EMPTY_ORG,
|
|
|
+ useOrganizationStatus: () => ({ loading: false, error: null, partial: {} }),
|
|
|
+ useOrganizationDemand: () => {},
|
|
|
+ reloadOrganizationData: async () => {},
|
|
|
+}));
|
|
|
+
|
|
|
+vi.mock("../../lib/customer-demo", async (loadMod) => ({
|
|
|
+ ...await loadMod<typeof import("../../lib/customer-demo")>(),
|
|
|
+ useCustomerDirectory: () => ({ rows: [], total: 0, loading: false, error: null, reload: () => {} }),
|
|
|
+}));
|
|
|
+
|
|
|
+vi.mock("../../lib/contract-demo", async (loadMod) => ({
|
|
|
+ ...await loadMod<typeof import("../../lib/contract-demo")>(),
|
|
|
+ useContractLedger: () => load({ items: [], total: 0, page: 0, page_size: 20 }),
|
|
|
+}));
|
|
|
+
|
|
|
+vi.mock("../../lib/order-demo", async (loadMod) => ({
|
|
|
+ ...await loadMod<typeof import("../../lib/order-demo")>(),
|
|
|
+ useSubscriptionLedger: () => load({ items: [], total: 0, page: 0, page_size: 20 }),
|
|
|
+ useSubscriptionStatusCounts: () => load({}),
|
|
|
+}));
|
|
|
+
|
|
|
+vi.mock("../../lib/package-catalog", async (loadMod) => ({
|
|
|
+ ...await loadMod<typeof import("../../lib/package-catalog")>(),
|
|
|
+ useCatalogLedger: () => load({ items: [], total: 0, page: 0, page_size: 20, fixed: [], custom: [] }),
|
|
|
+ useLineExits: () => load({ items: [] }),
|
|
|
+ useIpBandwidthTiers: () => load({ items: [] }),
|
|
|
+}));
|
|
|
+
|
|
|
+vi.mock("../../lib/ticket", async (loadMod) => ({
|
|
|
+ ...await loadMod<typeof import("../../lib/ticket")>(),
|
|
|
+ useTicketList: () => load({ rows: [], total: 0 }),
|
|
|
+ usePendingQueue: () => load({ rows: [], total: 0 }),
|
|
|
+ useTodoCounts: () => load({
|
|
|
+ item_1_pending_exec_overdue: 0,
|
|
|
+ item_2_service_open_incomplete: 0,
|
|
|
+ item_4_message_pending: 0,
|
|
|
+ note: "",
|
|
|
+ }),
|
|
|
+}));
|
|
|
+
|
|
|
+vi.mock("../../lib/work-order-counts", () => ({
|
|
|
+ useTicketStatusCounts: () => load({ total: 0 }),
|
|
|
+}));
|
|
|
+
|
|
|
+vi.mock("../../lib/cost-demo", async (loadMod) => ({
|
|
|
+ ...await loadMod<typeof import("../../lib/cost-demo")>(),
|
|
|
+ useCostItems: () => load({ items: [], total: 0 }),
|
|
|
+ useCostAmounts: () => load({
|
|
|
+ combos: [],
|
|
|
+ cells: new Map(),
|
|
|
+ available: true,
|
|
|
+ message: "",
|
|
|
+ rowsTotal: 0,
|
|
|
+ unattributedTotal: 0,
|
|
|
+ itemNames: new Map(),
|
|
|
+ total: 0,
|
|
|
+ }),
|
|
|
+}));
|
|
|
+
|
|
|
+vi.mock("../../lib/share-summary", async (loadMod) => ({
|
|
|
+ ...await loadMod<typeof import("../../lib/share-summary")>(),
|
|
|
+ useShareParamSummary: () => ({
|
|
|
+ items: new Map(),
|
|
|
+ loading: false,
|
|
|
+ fail: null,
|
|
|
+ message: "",
|
|
|
+ statsError: "",
|
|
|
+ reload: () => {},
|
|
|
+ }),
|
|
|
+}));
|
|
|
+
|
|
|
+vi.mock("../../lib/audit-logs", async (loadMod) => ({
|
|
|
+ ...await loadMod<typeof import("../../lib/audit-logs")>(),
|
|
|
+ useAuditList: () => ({
|
|
|
+ applied: {},
|
|
|
+ apply: () => {},
|
|
|
+ items: [],
|
|
|
+ nextCursor: null,
|
|
|
+ phase: { kind: "ready" },
|
|
|
+ loadingMore: false,
|
|
|
+ loadMore: () => {},
|
|
|
+ reload: () => {},
|
|
|
+ }),
|
|
|
+}));
|
|
|
+
|
|
|
+vi.mock("../../lib/scheduled-jobs", async (loadMod) => ({
|
|
|
+ ...await loadMod<typeof import("../../lib/scheduled-jobs")>(),
|
|
|
+ useJobCenter: () => ({
|
|
|
+ rows: [],
|
|
|
+ kpi: null,
|
|
|
+ pendingReruns: [],
|
|
|
+ runtimeAvailable: true,
|
|
|
+ runtimeError: null,
|
|
|
+ scheduler: null,
|
|
|
+ missingRegistryKeys: [],
|
|
|
+ loading: false,
|
|
|
+ error: null,
|
|
|
+ reload: () => {},
|
|
|
+ }),
|
|
|
+}));
|
|
|
+
|
|
|
+vi.mock("../../lib/overview-demo", async (loadMod) => {
|
|
|
+ const actual = await loadMod<typeof import("../../lib/overview-demo")>();
|
|
|
+ const zero = { state: "value" as const, value: 0, note: "" };
|
|
|
+ return {
|
|
|
+ ...actual,
|
|
|
+ useOverview: () => ({
|
|
|
+ errors: [],
|
|
|
+ alertsMsg: zero,
|
|
|
+ alertsReconFailed: zero,
|
|
|
+ alertsEmptyBill: zero,
|
|
|
+ alertsTotal: zero,
|
|
|
+ customerInUse: zero,
|
|
|
+ unbilledCents: { state: "pending" as const, value: null, note: "" },
|
|
|
+ billedCents: zero,
|
|
|
+ ticketsPending: zero,
|
|
|
+ ticketsProcessing: zero,
|
|
|
+ ticketsOpen: zero,
|
|
|
+ todoUnassigned: zero,
|
|
|
+ todoOverdue: zero,
|
|
|
+ todoExpiryStop: zero,
|
|
|
+ todoMessage: zero,
|
|
|
+ todoReconFailed: zero,
|
|
|
+ }),
|
|
|
+ };
|
|
|
+});
|
|
|
+
|
|
|
+const reconEmpty = {
|
|
|
+ data: {
|
|
|
+ items: [],
|
|
|
+ total: 0,
|
|
|
+ page_size: 20,
|
|
|
+ stats: { total_base_cents: 0, total_cost_cents: 0, total_share_cents: 0 },
|
|
|
+ },
|
|
|
+ loading: false,
|
|
|
+ fail: null,
|
|
|
+ reload: () => {},
|
|
|
+};
|
|
|
+
|
|
|
+vi.mock("../../lib/recon", async (loadMod) => ({
|
|
|
+ ...await loadMod<typeof import("../../lib/recon")>(),
|
|
|
+ useReconPeriods: () => ({ data: { periods: ["2026-10"] }, loading: false, fail: null, reload: () => {} }),
|
|
|
+ useReconList: () => reconEmpty,
|
|
|
+ useBillList: () => reconEmpty,
|
|
|
+ useCorrectionList: () => reconEmpty,
|
|
|
+ useBillingConfig: () => ({
|
|
|
+ data: {
|
|
|
+ default_recon_day: 5,
|
|
|
+ effective_mode: "period_snapshot",
|
|
|
+ operators: [],
|
|
|
+ row_version: 1,
|
|
|
+ },
|
|
|
+ loading: false,
|
|
|
+ fail: null,
|
|
|
+ reload: () => {},
|
|
|
+ }),
|
|
|
+}));
|
|
|
+
|
|
|
+vi.mock("../../lib/api/bos", async (loadMod) => {
|
|
|
+ const actual = await loadMod<typeof import("../../lib/api/bos")>();
|
|
|
+ const emptyList = async () => ({ items: [], total: 0, page: 0, page_size: 20 });
|
|
|
+ return {
|
|
|
+ ...actual,
|
|
|
+ billingConfigGet: async () => ({ default_recon_day: 5, effective_mode: "period_snapshot", operators: [] }),
|
|
|
+ importBatchGetList: emptyList,
|
|
|
+ customerGetList: emptyList,
|
|
|
+ contractGetList: emptyList,
|
|
|
+ operatorGetList: emptyList,
|
|
|
+ partnerGetList: emptyList,
|
|
|
+ reconGetList: emptyList,
|
|
|
+ reconGetPeriods: async () => ({ periods: ["2026-10"] }),
|
|
|
+ billGetList: emptyList,
|
|
|
+ customerGet: async () => ({ customer: { customer_name: "空态客户" }, sub_account_count: 0 }),
|
|
|
+ subAccountGetList: emptyList,
|
|
|
+ portalPlanBoard: async () => ({
|
|
|
+ current_rows: [],
|
|
|
+ history_rows: [],
|
|
|
+ notes: [],
|
|
|
+ amount_note: "",
|
|
|
+ party: { customer_name: "空态客户", region_path: null, operator_name: null },
|
|
|
+ }),
|
|
|
+ viewPartnerRecon: async () => ({
|
|
|
+ settle: { mode: null, value: null },
|
|
|
+ config: { recon_day: null, pay_cycle: "按月" },
|
|
|
+ batch_total: 0,
|
|
|
+ batch_shown: 0,
|
|
|
+ detail_total: 0,
|
|
|
+ detail_shown: 0,
|
|
|
+ batches: [],
|
|
|
+ details: [],
|
|
|
+ share_sum: 0,
|
|
|
+ share_sum_all: 0,
|
|
|
+ month_options: [{ period: "2026-10" }],
|
|
|
+ snapshot_state: "ok",
|
|
|
+ }),
|
|
|
+ };
|
|
|
+});
|
|
|
+
|
|
|
+afterEach(() => {
|
|
|
+ identity.current.role = "admin";
|
|
|
+ cleanup();
|
|
|
+});
|
|
|
+
|
|
|
+beforeEach(() => {
|
|
|
+ identity.current.role = "admin";
|
|
|
+});
|
|
|
+
|
|
|
+const ERR = /取数失败|请求失败|页面出错|未找到匹配路由|GatewayError|Something went wrong/i;
|
|
|
+
|
|
|
+async function mount(ui: ReactElement, path = "/") {
|
|
|
+ const view = render(<MemoryRouter initialEntries={[path]}>{ui}</MemoryRouter>);
|
|
|
+ await waitFor(() => {
|
|
|
+ expect(view.container.textContent || "").not.toMatch(ERR);
|
|
|
+ });
|
|
|
+ return view;
|
|
|
+}
|
|
|
+
|
|
|
+function pageText() {
|
|
|
+ return (document.body.textContent || "").replace(/\s+/g, " ");
|
|
|
+}
|
|
|
+
|
|
|
+it("区域管理:后端未下发节点时出空态,⛔ 白屏", async () => {
|
|
|
+ const { RegionManagementPage } = await import("../OrganizationPages");
|
|
|
+ await mount(<RegionManagementPage />);
|
|
|
+ expect(screen.getByText("后端未下发任何区域节点")).toBeTruthy();
|
|
|
+});
|
|
|
+
|
|
|
+it("运营商/合伙人:行源为空出「暂无数据」", async () => {
|
|
|
+ const { OperatorManagementPage, PartnerManagementPage } = await import("../OrganizationPages");
|
|
|
+ await mount(<OperatorManagementPage />);
|
|
|
+ expect(screen.getByText("暂无数据")).toBeTruthy();
|
|
|
+ cleanup();
|
|
|
+ await mount(<PartnerManagementPage />);
|
|
|
+ expect(screen.getByText("暂无数据")).toBeTruthy();
|
|
|
+});
|
|
|
+
|
|
|
+it("运营团队/运维团队:行源为空出专属空态句", async () => {
|
|
|
+ const { OperationsTeamManagementPage, MaintenanceTeamLedgerPage } = await import("../OrganizationPages");
|
|
|
+ await mount(<OperationsTeamManagementPage />);
|
|
|
+ expect(screen.getByText("暂无运营团队")).toBeTruthy();
|
|
|
+ cleanup();
|
|
|
+ await mount(<MaintenanceTeamLedgerPage />);
|
|
|
+ expect(screen.getByText("暂无运维团队")).toBeTruthy();
|
|
|
+});
|
|
|
+
|
|
|
+it("客户管理:无筛无行出「暂无数据」;带筛无命中出另一句", async () => {
|
|
|
+ const { CustomerListPage } = await import("../CustomerRecordsPages");
|
|
|
+ await mount(<CustomerListPage />, "/customers");
|
|
|
+ expect(screen.getByText("暂无数据")).toBeTruthy();
|
|
|
+ expect(screen.queryByText("没有符合筛选条件的数据")).toBeNull();
|
|
|
+ cleanup();
|
|
|
+ await mount(<CustomerListPage />, "/customers?query=zzzzqqq");
|
|
|
+ expect(screen.getByText("没有符合筛选条件的数据")).toBeTruthy();
|
|
|
+});
|
|
|
+
|
|
|
+it("合同管理:空台账出筛选空态句(本页行源为空与无命中同句)", async () => {
|
|
|
+ const { ContractManagementPage } = await import("../ContractManagementPage");
|
|
|
+ await mount(<ContractManagementPage />);
|
|
|
+ expect(screen.getByText("没有符合筛选条件的合同。")).toBeTruthy();
|
|
|
+});
|
|
|
+
|
|
|
+it("全部订阅:空台账出「没有匹配的订阅」", async () => {
|
|
|
+ const { OrderManagementPage } = await import("../OrderManagementPage");
|
|
|
+ await mount(<OrderManagementPage />);
|
|
|
+ expect(screen.getByRole("heading", { name: "没有匹配的订阅" })).toBeTruthy();
|
|
|
+});
|
|
|
+
|
|
|
+it("套餐配置:固定档空目录出专属空态", async () => {
|
|
|
+ const { PackageManagementPage } = await import("../PackageManagementPage");
|
|
|
+ await mount(<PackageManagementPage />);
|
|
|
+ expect(screen.getByText("目录里还没有固定套餐档。")).toBeTruthy();
|
|
|
+});
|
|
|
+
|
|
|
+it("批量导入:空批次出「没有匹配的记录」", async () => {
|
|
|
+ const { ImportBatchPage } = await import("../CustomerManagementPages");
|
|
|
+ await mount(<ImportBatchPage />);
|
|
|
+ await screen.findByRole("heading", { name: "没有匹配的记录" });
|
|
|
+});
|
|
|
+
|
|
|
+it("分成管理:分成方行源为空出档案空态句", async () => {
|
|
|
+ const { ShareRulePage } = await import("../SettlementPages");
|
|
|
+ await mount(<ShareRulePage />);
|
|
|
+ expect(screen.getByText("第 1 册档案里还没有运营商/合伙人/运维团队(分成方行源为空)")).toBeTruthy();
|
|
|
+});
|
|
|
+
|
|
|
+it("成本管理:成本项 total:0 出真实空态", async () => {
|
|
|
+ const { CostManagementPage } = await import("../FinanceReferencePages");
|
|
|
+ await mount(<CostManagementPage />);
|
|
|
+ expect(screen.getByText(/后端未返回任何成本项/)).toBeTruthy();
|
|
|
+});
|
|
|
+
|
|
|
+it("对账清单/账单明细:空行出筛选空态句", async () => {
|
|
|
+ const { SettlementStatementListPage, SettlementBillListPage } = await import("../SettlementRecordPages");
|
|
|
+ await mount(<SettlementStatementListPage />);
|
|
|
+ expect(screen.getByText("没有符合筛选条件的对账清单。")).toBeTruthy();
|
|
|
+ cleanup();
|
|
|
+ await mount(<SettlementBillListPage />);
|
|
|
+ expect(screen.getByText("没有符合筛选条件的账单明细。")).toBeTruthy();
|
|
|
+});
|
|
|
+
|
|
|
+it("出账更正记录:空行出「没有符合条件的更正记录。」", async () => {
|
|
|
+ const { CorrectionNotesPage } = await import("../FinanceReferencePages");
|
|
|
+ await mount(<CorrectionNotesPage />);
|
|
|
+ expect(screen.getByText("没有符合条件的更正记录。")).toBeTruthy();
|
|
|
+});
|
|
|
+
|
|
|
+it("出账配置:无可配置运营商出空态", async () => {
|
|
|
+ const { ReconciliationSettingsPage } = await import("../SettlementPages");
|
|
|
+ await mount(<ReconciliationSettingsPage />);
|
|
|
+ expect(screen.getByText("暂无可配置出账的运营商。")).toBeTruthy();
|
|
|
+});
|
|
|
+
|
|
|
+it("全部工单:无筛无行出「暂无工单」", async () => {
|
|
|
+ const { WorkOrderLedgerPage } = await import("../WorkOrderManagementPage");
|
|
|
+ await mount(<WorkOrderLedgerPage />);
|
|
|
+ expect(screen.getAllByRole("heading", { name: "暂无工单" }).length).toBeGreaterThan(0);
|
|
|
+});
|
|
|
+
|
|
|
+it("全部工单:带筛无命中出「没有匹配的工单」", async () => {
|
|
|
+ const { WorkOrderLedgerPage } = await import("../WorkOrderManagementPage");
|
|
|
+ await mount(<WorkOrderLedgerPage />, "/work-orders?q=zzzz");
|
|
|
+ expect(screen.getAllByRole("heading", { name: "没有匹配的工单" }).length).toBeGreaterThan(0);
|
|
|
+});
|
|
|
+
|
|
|
+it("工单总览:最近工单与待分派队列各出空态", async () => {
|
|
|
+ const { WorkOrderOverviewPage } = await import("../WorkOrderOverviewPage");
|
|
|
+ await mount(<WorkOrderOverviewPage />);
|
|
|
+ expect(screen.getAllByText("当前范围内暂无工单").length).toBeGreaterThan(0);
|
|
|
+ expect(screen.getAllByText("暂无待分派工单").length).toBeGreaterThan(0);
|
|
|
+});
|
|
|
+
|
|
|
+it("我的待办:空列表出「今天没有待办」", async () => {
|
|
|
+ const { WorkOrderMinePage } = await import("../WorkOrderMinePage");
|
|
|
+ await mount(<WorkOrderMinePage />);
|
|
|
+ expect(screen.getByRole("heading", { name: "今天没有待办" })).toBeTruthy();
|
|
|
+});
|
|
|
+
|
|
|
+it("待分派:队列空出「当前队列已清空」", async () => {
|
|
|
+ const { WorkOrderQueuePage } = await import("../WorkOrderQueuePage");
|
|
|
+ await mount(
|
|
|
+ <Routes>
|
|
|
+ <Route path="/work-orders/queue" element={<WorkOrderQueuePage />} />
|
|
|
+ </Routes>,
|
|
|
+ "/work-orders/queue",
|
|
|
+ );
|
|
|
+ expect(screen.getByRole("heading", { name: "当前队列已清空" })).toBeTruthy();
|
|
|
+});
|
|
|
+
|
|
|
+it("交付与回执:待回执空列表出专属空态", async () => {
|
|
|
+ const { WorkOrderDeliveryPage } = await import("../WorkOrderDeliveryPage");
|
|
|
+ await mount(<WorkOrderDeliveryPage />);
|
|
|
+ expect(screen.getByRole("heading", { name: "没有等待回执的工单" })).toBeTruthy();
|
|
|
+});
|
|
|
+
|
|
|
+it("审计日志:ready 且 0 行出 W15", async () => {
|
|
|
+ const { AuditLogPage } = await import("../AuditLogPage");
|
|
|
+ await mount(<AuditLogPage />);
|
|
|
+ expect(screen.getByText(W15)).toBeTruthy();
|
|
|
+});
|
|
|
+
|
|
|
+it("定时任务:注册位为空出空态", async () => {
|
|
|
+ const { ScheduledJobManagementPage } = await import("../ScheduledJobManagementPage");
|
|
|
+ await mount(<ScheduledJobManagementPage />);
|
|
|
+ expect(screen.getByText("调度平台注册位为空。")).toBeTruthy();
|
|
|
+});
|
|
|
+
|
|
|
+it("我的套餐:当前/往期两表空态分句", async () => {
|
|
|
+ identity.current.role = "enterprise";
|
|
|
+ const { CustomerPlanPage } = await import("../CustomerSelfServicePages");
|
|
|
+ await mount(
|
|
|
+ <Routes>
|
|
|
+ <Route path="/workspace/plan" element={<CustomerPlanPage />} />
|
|
|
+ </Routes>,
|
|
|
+ "/workspace/plan",
|
|
|
+ );
|
|
|
+ await screen.findByText("当前没有待生效或生效中的套餐。");
|
|
|
+ expect(screen.getByText("没有已到期或已终止的套餐。")).toBeTruthy();
|
|
|
+});
|
|
|
+
|
|
|
+it("下属分账号:空列表出「暂无分账号。」", async () => {
|
|
|
+ identity.current.role = "enterprise";
|
|
|
+ const { CustomerAccountsPage } = await import("../CustomerSelfServicePages");
|
|
|
+ await mount(
|
|
|
+ <Routes>
|
|
|
+ <Route path="/workspace/accounts" element={<CustomerAccountsPage />} />
|
|
|
+ </Routes>,
|
|
|
+ "/workspace/accounts",
|
|
|
+ );
|
|
|
+ await screen.findByText("暂无分账号。");
|
|
|
+});
|
|
|
+
|
|
|
+it("工单进度(客户):空列表出「还没有工单」", async () => {
|
|
|
+ identity.current.role = "enterprise";
|
|
|
+ const { CustomerTicketProgressPage } = await import("../CustomerTicketPages");
|
|
|
+ await mount(
|
|
|
+ <Routes>
|
|
|
+ <Route path="/workspace/progress" element={<CustomerTicketProgressPage />} />
|
|
|
+ </Routes>,
|
|
|
+ "/workspace/progress",
|
|
|
+ );
|
|
|
+ expect(screen.getByRole("heading", { name: "还没有工单" })).toBeTruthy();
|
|
|
+});
|
|
|
+
|
|
|
+it("本方对账/客户清单/合同清单:空行出 VIEW_LIST_EMPTY", async () => {
|
|
|
+ identity.current.role = "partner";
|
|
|
+ const { PartnerReconPage, PartyCustomerListPage, PartyContractListPage } = await import("../PartyViewPages");
|
|
|
+ await mount(<PartnerReconPage />);
|
|
|
+ await waitFor(() => expect(pageText()).toContain(VIEW_LIST_EMPTY));
|
|
|
+ expect(pageText()).not.toMatch(ERR);
|
|
|
+ cleanup();
|
|
|
+ identity.current.role = "partner";
|
|
|
+ await mount(<PartyCustomerListPage kind="partner" />);
|
|
|
+ await waitFor(() => expect(screen.getAllByText(VIEW_LIST_EMPTY).length).toBeGreaterThan(0));
|
|
|
+ cleanup();
|
|
|
+ identity.current.role = "operator";
|
|
|
+ await mount(<PartyContractListPage kind="operator" />);
|
|
|
+ await waitFor(() => expect(screen.getAllByText(VIEW_LIST_EMPTY).length).toBeGreaterThan(0));
|
|
|
+});
|
|
|
+
|
|
|
+it("空态页仍有页头,且不含 role=alert 错误条", async () => {
|
|
|
+ const { CustomerListPage } = await import("../CustomerRecordsPages");
|
|
|
+ await mount(<CustomerListPage />);
|
|
|
+ expect(screen.getByRole("heading", { name: "客户管理" })).toBeTruthy();
|
|
|
+ expect(document.querySelector('[role="alert"]')).toBeNull();
|
|
|
+});
|