import { describe, expect, test } from "bun:test"; import { DEFAULT_PLANS, planAllowsEditorContainers } from "./plans"; describe("planAllowsEditorContainers", () => { test("scratch has no editor allowance and a zero cap", () => { expect(planAllowsEditorContainers(DEFAULT_PLANS.scratch)).toBe(false); }); test("free and pro include editor time", () => { expect(planAllowsEditorContainers(DEFAULT_PLANS.free)).toBe(true); expect(planAllowsEditorContainers(DEFAULT_PLANS.pro)).toBe(true); }); test("a plan with the allowance zeroed and a zero hard cap is refused", () => { const plan = { ...DEFAULT_PLANS.free, included: { ...DEFAULT_PLANS.free.included, "compute.editor": 0 }, hardCaps: { ...DEFAULT_PLANS.free.hardCaps, "compute.editor": 0 }, }; expect(planAllowsEditorContainers(plan)).toBe(false); }); test("an uncapped plan with no allowance still bills overage, so it is allowed", () => { const plan = { ...DEFAULT_PLANS.pro, included: { ...DEFAULT_PLANS.pro.included, "compute.editor": 0 } }; expect(planAllowsEditorContainers(plan)).toBe(true); }); });