import { expect, test } from "@playwright/test"; import { getAdaptiveImageQueueOwnerLimit } from "@/lib/canvas/image-queue-fairness"; test.describe("canvas image queue fairness", () => { test("lets one owner use the full model capacity without competition", () => { expect( getAdaptiveImageQueueOwnerLimit({ maxConcurrent: 10, hasCompetingOwner: false, }) ).toBe(10); }); test("reserves half the slots when another owner is waiting", () => { expect( getAdaptiveImageQueueOwnerLimit({ maxConcurrent: 10, hasCompetingOwner: true, }) ).toBe(5); expect( getAdaptiveImageQueueOwnerLimit({ maxConcurrent: 5, hasCompetingOwner: true, }) ).toBe(3); }); test("always keeps at least one executable slot", () => { expect( getAdaptiveImageQueueOwnerLimit({ maxConcurrent: 0, hasCompetingOwner: true, }) ).toBe(1); }); });