import { render, screen } from "@testing-library/react";
import { expect, test, vi } from "vitest";
import { LuckyGiftPoolModal } from "./LuckyGiftPoolModal.jsx";

test("renders lucky gift pool turnover payout and profit", () => {
  render(
    <LuckyGiftPoolModal
      items={[
        { payout: 300, payout_rate: 0.3, pool_id: "lucky_100", profit: 700, profit_rate: 0.7, turnover: 1_000 },
        { payout: 50, payout_rate: 0.1, pool_id: "super_lucky", profit: 450, profit_rate: 0.9, turnover: 500 }
      ]}
      onClose={vi.fn()}
    />
  );

  expect(screen.getByRole("dialog", { name: /幸运礼物奖池明细/ })).toBeInTheDocument();
  expect(screen.getByText("总流水")).toBeInTheDocument();
  expect(screen.getByText("1,500")).toBeInTheDocument();
  expect(screen.getByText("lucky_100")).toBeInTheDocument();
  expect(screen.getByText("super_lucky")).toBeInTheDocument();
  expect(screen.getByText("700")).toBeInTheDocument();
  expect(screen.getByText("450")).toBeInTheDocument();
});
