import { describe, expect, it } from "vitest";
import { render, screen } from "@testing-library/react";
import EarningsSummary from "@/components/earnings/EarningsSummary";

describe("EarningsSummary", () => {
  it("renders a red downward indicator when monthly profit declines", () => {
    render(
      <EarningsSummary
        currency="SAR"
        kpis={{
          profit_share_percent: 18,
          avg_daily_profit_30d: 20,
          total_profit: 1200,
          profit_this_month: {
            label: "أرباح هذا الشهر",
            value: 400,
            change: { formatted: "-8%", label: "من الشهر الماضي", trend: "down" },
          },
        }}
      />,
    );

    expect(screen.getByText(/-8% من الشهر الماضي ↓/)).toHaveClass("text-red-400");
  });
});
