import { describe, expect, it } from "vitest";

import { shouldShowEzpayConfirmation } from "../use-payment-launch-flow";

describe("shouldShowEzpayConfirmation", () => {
  it("shows confirmation for Ezpay in non-production builds", () => {
    expect(
      shouldShowEzpayConfirmation({
        currentOrderId: "order-1",
        isProduction: false,
        payParams: { provider: "ezpay" },
        paymentUrl: "https://pay.example/checkout",
      }),
    ).toBe(true);
  });

  it("does not show confirmation in production", () => {
    expect(
      shouldShowEzpayConfirmation({
        currentOrderId: "order-1",
        isProduction: true,
        payParams: { provider: "ezpay" },
        paymentUrl: "https://pay.example/checkout",
      }),
    ).toBe(false);
  });

  it("does not show confirmation without an order id", () => {
    expect(
      shouldShowEzpayConfirmation({
        currentOrderId: null,
        isProduction: false,
        payParams: { provider: "ezpay" },
        paymentUrl: "https://pay.example/checkout",
      }),
    ).toBe(false);
  });

  it("does not show confirmation for non-Ezpay providers", () => {
    expect(
      shouldShowEzpayConfirmation({
        currentOrderId: "order-1",
        isProduction: false,
        payParams: { provider: "stripe" },
        paymentUrl: "https://pay.example/checkout",
      }),
    ).toBe(false);
  });
});
