import { describe, expect, test } from "vitest";
import { p1BenefitCatalog, vipProgramDefaults } from "./constants.js";

describe("P1 VIP defaults", () => {
    test("keeps the confirmed target-only program policies", () => {
        expect(vipProgramDefaults.tiered_privilege_v1).toMatchObject({
            benefitInheritancePolicy: "target_only",
            grantMode: "trial_card",
            levelCount: 9,
            trialCardEnabled: true,
            upgradeExpiryPolicy: "replace_from_now",
        });
        expect(vipProgramDefaults.legacy_timed).toMatchObject({
            benefitInheritancePolicy: "target_only",
            grantMode: "direct_membership",
            levelCount: 10,
            upgradeExpiryPolicy: "extend_remaining",
        });
    });

    test("keeps the product catalog without using unlock level as inheritance policy", () => {
        expect(p1BenefitCatalog).toHaveLength(34);
        expect(p1BenefitCatalog.find((benefit) => benefit.benefitCode === "daily_coin_rebate")?.trialEnabled).toBe(
            false,
        );
        expect(p1BenefitCatalog.find((benefit) => benefit.benefitCode === "anti_kick")).toMatchObject({
            benefitType: "function",
            executionScope: "room",
            unlockLevel: 9,
        });
    });
});
