You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
chajia/__tests__/scripts/diag-flock-logged-in-x20.te...

27 lines
959 B

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<string>();
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);
}
});
});