import { render, screen } from "@testing-library/react"; import { expect, test, vi } from "vitest"; import { FinanceRechargeDetailList } from "./FinanceRechargeDetailList.jsx"; const baseProps = { bills: { items: [], page: 1, pageSize: 50, total: 0, }, error: "", filters: { appCode: "", keyword: "", page: 1, timeRange: { endMs: "", startMs: "" }, }, loading: false, onFiltersChange: vi.fn(), onReload: vi.fn(), options: { apps: [ { appCode: "lalu", appName: "lalu" }, { appCode: "aslan", appName: "Aslan" }, ], }, }; test("renders app recharge detail columns and values", () => { render( , ); expect(screen.getByRole("columnheader", { name: "APP" })).toBeInTheDocument(); expect(screen.getByRole("columnheader", { name: "充值总额" })).toBeInTheDocument(); expect(screen.getByRole("columnheader", { name: "充值来源" })).toBeInTheDocument(); expect(screen.getByRole("columnheader", { name: "充值订单号" })).toBeInTheDocument(); expect(screen.getByRole("columnheader", { name: "美金换算" })).toBeInTheDocument(); expect(screen.getByRole("columnheader", { name: "账单金额" })).toBeInTheDocument(); expect(screen.getByRole("columnheader", { name: "用户实付" })).toBeInTheDocument(); expect(screen.getByRole("columnheader", { name: "三方税率扣款" })).toBeInTheDocument(); expect(screen.getByText("Aslan")).toBeInTheDocument(); expect(screen.getByText("90,000 金币")).toBeInTheDocument(); expect(screen.getByText("谷歌充值")).toBeInTheDocument(); expect(screen.getByText("tx-google")).toBeInTheDocument(); expect(screen.getByText("cmd-1 / GPA.1")).toBeInTheDocument(); expect(screen.getByText("90,000 金币 = USD 9.99")).toBeInTheDocument(); expect(screen.getAllByText("SAR 12.99")).toHaveLength(2); expect(screen.getByText("SAR 1.95 / 15%")).toBeInTheDocument(); expect(screen.getByRole("button", { name: /充值时间 · 中国时区/ })).toBeInTheDocument(); }); test("keeps empty recharge detail table colspan aligned with visible columns", () => { const { container } = render(); expect(container.querySelector("tbody td")?.colSpan).toBe(9); expect(screen.getByText("当前无数据")).toBeInTheDocument(); });