import { describe, expect, it } from "vitest";
import { shouldShowTrialUpsell } from "./TrialUpsellModal";

describe("shouldShowTrialUpsell", () => {
  it("does not show when trial has more than 7 days remaining", () => {
    expect(
      shouldShowTrialUpsell({
        isTrialExpired: false,
        activeSubscriptionPlan: null,
        daysRemaining: 14,
      })
    ).toBe(false);
  });

  it("shows when trial is within reminder window and user has no subscription", () => {
    expect(
      shouldShowTrialUpsell({
        isTrialExpired: false,
        activeSubscriptionPlan: null,
        daysRemaining: 3,
      })
    ).toBe(true);
  });

  it("does not show when trial is expired", () => {
    expect(
      shouldShowTrialUpsell({
        isTrialExpired: true,
        activeSubscriptionPlan: null,
        daysRemaining: null,
      })
    ).toBe(false);
  });

  it("does not show when organization already has a paid subscription", () => {
    expect(
      shouldShowTrialUpsell({
        isTrialExpired: false,
        activeSubscriptionPlan: "team",
        daysRemaining: 2,
      })
    ).toBe(false);
  });

});
