Files
PacketStation/frontend/src/test/packets.ts
T

131 lines
3.0 KiB
TypeScript
Raw Normal View History

// Synthetic packet answers for the screen tests. No real job data.
import type { PacketCard, PacketRead, Project, Unit } from "../api/types";
export function makeCard(over: Partial<PacketCard> = {}): PacketCard {
return {
id: 1,
version: 1,
unit: { id: 11, number: "L999001" },
project: { id: 7, number: "L999", name: "CI project" },
dept: { code: "03", name: "Weld Parts" },
op: "WELD-PART",
title: "CI spool",
customer: "Test Co",
drawing: "CI-DWG-1",
rev: "0",
status: "draft",
status_at: "2026-10-16T08:00:00Z",
station: null,
welder: null,
routed_to: null,
vclosed: null,
source_kind: "hand",
flag: null,
open_cos: [],
open_shorts: 0,
wh_stage: null,
due_effective: null,
updated_at: "2026-10-16T08:00:00Z",
holder: "Clerical",
can: [],
blocked: {},
...over,
};
}
export function makePacket(over: Partial<PacketRead> = {}): PacketRead {
return {
id: 1,
version: 3,
unit: {
id: 11,
number: "L999001",
lot: "001",
name: null,
project: { id: 7, number: "L999", name: "CI project", customer: "Test Co", po: null, status: "open" },
due_effective: null,
},
dept: { code: "03", name: "Weld Parts", weld: true },
op: "WELD-PART",
title: "CI spool",
customer: "Test Co",
drawing: "CI-DWG-1",
rev: "0",
wps: null,
status: "draft",
status_at: "2026-10-16T08:00:00Z",
station: null,
welder: null,
for_sup: null,
heat_map: null,
wh_skipped: false,
wh_sent_at: null,
routed_to: null,
return_note: null,
vclosed: null,
databook_at: null,
source_kind: "hand",
source: { kind: "hand" },
drawing_state: "none",
flags: ["hand"],
visual: {},
removed: null,
work_orders: [{ id: 1, wo_base: "L999001", lot: "001", split: "0", sub: "0", qty: 1, target_hrs: 2, row_version: 1 }],
pages: [],
bom: [],
welds: [],
heat_tags: [],
heat_table: [],
stage: null,
stages: [],
wh: null,
qc: null,
qc_history: [],
change_orders: [],
open_cos: [],
open_shorts: 0,
docs: [],
seal: null,
can: ["edit_header", "edit_drawing_ref", "edit_document_set", "move_unit", "remove"],
blocked: { send_to_warehouse: ["Say whether this packet needs a heat map."] },
holder: "Clerical",
checklist_items: [],
qc_items: [],
flag: null,
...over,
};
}
export function makeProject(over: Partial<Project> = {}): Project {
return {
id: 7,
number: "L999",
name: "CI project",
customer: "Test Co",
po: null,
due: null,
status: "open",
notes: null,
units: 1,
packets: { draft: 1, warehouse: 0, shop: 0, qc: 0, complete: 0, filed: 0, total: 1 },
version: 1,
...over,
};
}
export function makeUnit(over: Partial<Unit> = {}): Unit {
return {
id: 11,
project_id: 7,
number: "L999001",
lot: "001",
name: null,
due: null,
due_effective: null,
status: "open",
notes: null,
version: 1,
...over,
};
}