Files
edr-platform/apps/edr-freight-web/backoffice/src/utils/compareSchedulingPriority.test.ts

26 lines
881 B
TypeScript

import { describe, expect, it } from "vitest";
import { compareSchedulingPriority } from "./compareSchedulingPriority";
describe("compareSchedulingPriority", () => {
it("ranks government above commercial regardless of date gap", () => {
const gov = {
isGovernment: true,
priorityScore: 100,
scheduledDate: "2026-06-25T08:00:00.000Z",
};
const commercial = {
isGovernment: false,
priorityScore: 50000,
scheduledDate: "2026-06-20T08:00:00.000Z",
};
expect(compareSchedulingPriority(gov, commercial)).toBeLessThan(0);
});
it("sorts by priority score within same tier", () => {
const high = { priorityScore: 100, scheduledDate: "2026-06-20T08:00:00.000Z" };
const low = { priorityScore: 10, scheduledDate: "2026-06-20T08:00:00.000Z" };
expect(compareSchedulingPriority(high, low)).toBeLessThan(0);
});
});