require "rails_helper"

RSpec.describe Billing::Stripe::PlanChangeKind do
  before { load Rails.root.join("db/seeds/plans.rb") }

  it "classifica light → full come upgrade" do
    expect(described_class.classify(
      from_plan_slug: "premium_light",
      from_interval: "monthly",
      to_plan_slug: "premium_full",
      to_interval: "monthly"
    )).to eq(:upgrade)
  end

  it "classifica full → light come downgrade" do
    expect(described_class.classify(
      from_plan_slug: "premium_full",
      from_interval: "monthly",
      to_plan_slug: "premium_light",
      to_interval: "monthly"
    )).to eq(:downgrade)
  end

  it "classifica passaggio a annuale come upgrade sullo stesso piano" do
    expect(described_class.classify(
      from_plan_slug: "premium_light",
      from_interval: "monthly",
      to_plan_slug: "premium_light",
      to_interval: "yearly"
    )).to eq(:upgrade)
  end
end
