mirror of
https://github.com/Sea-Haven-Industries/shoc-frontend-new.git
synced 2026-10-04 23:02:07 +00:00
Dispatchers can flag Aveta on Service and Notes and filter those rows without a site-level attribute.
72 lines
1.9 KiB
TypeScript
72 lines
1.9 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { resolveFirstCellShadow } from "@/app/(protected)/workorders/_components/list/table/wo-table-row-style";
|
|
import { EMPTY_UPLIFT_SUMMARY } from "@/domain/work-orders/types/work-order-uplift";
|
|
import type { WorkOrderTableRow } from "@/domain/work-orders/types/work-order-table-row";
|
|
|
|
function row(overrides: Partial<WorkOrderTableRow> = {}): WorkOrderTableRow {
|
|
return {
|
|
id: "1",
|
|
woNumber: "24877",
|
|
site: "BK5",
|
|
type: "PM",
|
|
severity: null,
|
|
dispatcherId: "",
|
|
dispatcherName: "",
|
|
scheduledOn: "",
|
|
completedDate: "",
|
|
targetWeek: "",
|
|
dayGroup: "",
|
|
dayLabel: "",
|
|
location: "",
|
|
locationId: "",
|
|
pm: "",
|
|
serviceNotes: "",
|
|
extraServices: [],
|
|
vendorId: "",
|
|
company: "",
|
|
tech: "",
|
|
techPhone: "",
|
|
apptStart: "",
|
|
apptEnd: "",
|
|
apptTime: "",
|
|
status: "Scheduled",
|
|
docStatus: "",
|
|
pocName: "",
|
|
pocPhone: "",
|
|
pocNotes: "",
|
|
additionalContacts: [],
|
|
dueDate: "",
|
|
rescheduleCount: 0,
|
|
carriedOver: 0,
|
|
isAddOn: false,
|
|
originalWeek: "",
|
|
originalDate: "",
|
|
isPastDue: false,
|
|
scheduleWeekOnly: false,
|
|
mediaCount: 0,
|
|
title: "",
|
|
priority: "",
|
|
primaryDispatchId: null,
|
|
rowVersion: "",
|
|
dispatchRowVersion: "",
|
|
flagColor: null,
|
|
upliftSummary: EMPTY_UPLIFT_SUMMARY,
|
|
...overrides,
|
|
};
|
|
}
|
|
|
|
describe("resolveFirstCellShadow", () => {
|
|
it("uses a red inset for Emergency over Past Due", () => {
|
|
expect(resolveFirstCellShadow(row({ type: "Emergency", isPastDue: true }))).toBe(
|
|
"inset 3px 0 0 var(--destructive)",
|
|
);
|
|
});
|
|
|
|
it("uses a warning inset for Past Due when the type is not Emergency", () => {
|
|
expect(resolveFirstCellShadow(row({ isPastDue: true }))).toBe("inset 3px 0 0 var(--warning)");
|
|
});
|
|
|
|
it("has no inset for a regular row", () => {
|
|
expect(resolveFirstCellShadow(row())).toBe("none");
|
|
});
|
|
});
|