import { describe, expect, it } from "vitest"; import { createRequire } from "node:module"; const require = createRequire(import.meta.url); const { buildRRPreviewMetadata } = require("./rr-preview-metadata"); describe("server/rr/rr-preview-metadata", () => { it("captures ROGOG preview rows and totals", () => { const metadata = buildRRPreviewMetadata({ payload: { outsdRoNo: "RO-100", rogg: { ops: [ { opCode: "BODY", jobNo: "1", segmentKind: "laborTaxable", segmentCount: 2, lines: [ { breakOut: "B", itemType: "LAB", itemDesc: "Body Labor", custQty: "1.0", custPayTypeFlag: "C", custTxblNtxblFlag: "T", amount: { custPrice: "125.00", dlrCost: "50.00" } } ] } ] } }, result: { roNo: "12345" } }); expect(metadata).toMatchObject({ provider: "rr", previewFormat: "rr-rogog-preview.v1", roNo: "12345", outsdRoNo: "RO-100", rogg: { rows: [ { opCode: "BODY", jobNo: "1", breakOut: "B", itemType: "LAB", itemDesc: "Body Labor (Labor Taxable)", custTxblNtxblFlag: "T", custPrice: "125.00", dlrCost: "50.00" } ], totals: { totalCustPriceCents: 12500, totalDlrCostCents: 5000, totalCustPrice: "125.00", totalDlrCost: "50.00" } } }); expect(metadata).not.toHaveProperty("rolabor"); }); });