import { describe, expect, it } from "vitest"; import { FLOCK_LOGGED_IN_X20_CASES } from "@/scripts/diag-flock-logged-in-x20"; import { fitsFlockTrailerCargo } from "@/lib/constants/flock-limits"; describe("FLOCK_LOGGED_IN_X20_CASES", () => { it("恰好 20 组且 ZIP/货物合法", () => { expect(FLOCK_LOGGED_IN_X20_CASES).toHaveLength(20); const names = new Set(); for (const c of FLOCK_LOGGED_IN_X20_CASES) { expect(c.pickupZip).toMatch(/^\d{5}$/); expect(c.deliveryZip).toMatch(/^\d{5}$/); expect(c.pickupZip).not.toBe(c.deliveryZip); expect(c.palletCount).toBeGreaterThanOrEqual(1); expect(c.totalWeightLb).toBeLessThanOrEqual(45_000); expect( fitsFlockTrailerCargo({ palletCount: c.palletCount, lengthIn: c.lengthIn, widthIn: c.widthIn, }), ).toBe(true); expect(names.has(c.name)).toBe(false); names.add(c.name); } }); });