import { test, expect } from "@playwright/test";
import { USERS, login } from "./helpers";

/**
 * Issue #50 — the manager approved-spend card uses the rupee symbol and compact
 * Indian formatting (₹… with L / Cr / K), not a dollar sign.
 */
test("#50 'Total Approved Spend' card shows ₹ with compact L/Cr/K formatting", async ({ page }) => {
  await login(page, USERS.MANAGER);
  await page.goto("/dashboard");

  const card = page.locator("div").filter({ has: page.getByText("Total Approved Spend", { exact: true }) }).first();
  await expect(card).toBeVisible();
  // ₹ present, no dollar sign, value matches the compact format (₹2 Cr / ₹49 L / ₹75 K / ₹500).
  await expect(card).toContainText("₹");
  await expect(card).not.toContainText("$");
  await expect(card).toContainText(/₹\s?-?\d[\d.,]*\s?(Cr|L|K)?/);
});
