feat(sp7): ServiceLinesTable — Paid + Adjustments columns
This commit is contained in:
@@ -117,9 +117,9 @@ describe("ServiceLinesTable", () => {
|
||||
// Row carries the line number as a data attribute for test stability.
|
||||
expect(rows[0].getAttribute("data-line-number")).toBe("1");
|
||||
|
||||
// Cells: line #, procedure, charge, units, date.
|
||||
// Cells: line #, procedure, charge, units, date, paid, adjustments.
|
||||
const cells = rows[0].querySelectorAll("td");
|
||||
expect(cells.length).toBe(5);
|
||||
expect(cells.length).toBe(7);
|
||||
|
||||
const cellText = Array.from(cells).map((c) => c.textContent ?? "");
|
||||
expect(cellText[0]).toContain("1"); // line #
|
||||
@@ -128,10 +128,52 @@ describe("ServiceLinesTable", () => {
|
||||
expect(cellText[3]).toContain("1"); // units count
|
||||
expect(cellText[3]).toContain("UN"); // units type
|
||||
expect(cellText[4]).toContain("2026"); // date (year at minimum)
|
||||
// Paid + Adjustments default to em-dash when no lineReconciliation is provided.
|
||||
expect(cellText[5]).toContain("—");
|
||||
expect(cellText[6]).toContain("—");
|
||||
|
||||
unmount();
|
||||
});
|
||||
|
||||
it("test_paid_and_adjustments_columns_render_from_lineReconciliation", () => {
|
||||
const line = makeLine({ lineNumber: 1, charge: 100.0 });
|
||||
const lineReconciliation = [
|
||||
{ lineNumber: 1, status: "matched" as const, paid: "80.00", adjustmentsSum: "20.00" },
|
||||
];
|
||||
const { container, unmount } = renderIntoContainer(
|
||||
<ServiceLinesTable
|
||||
serviceLines={[line]}
|
||||
lineReconciliation={lineReconciliation}
|
||||
/>
|
||||
);
|
||||
const row = container.querySelector('[data-testid="service-line-row"]');
|
||||
expect(row).not.toBeNull();
|
||||
const paid = row?.querySelector('[data-testid="paid-cell"]');
|
||||
const adjustments = row?.querySelector('[data-testid="adjustments-cell"]');
|
||||
expect(paid?.textContent ?? "").toContain("$80.00");
|
||||
expect(adjustments?.textContent ?? "").toContain("$20.00");
|
||||
unmount();
|
||||
});
|
||||
|
||||
it("test_paid_and_adjustments_render_em_dash_when_null", () => {
|
||||
const line = makeLine({ lineNumber: 1 });
|
||||
const lineReconciliation = [
|
||||
{ lineNumber: 1, status: "unmatched_837_only" as const, paid: null, adjustmentsSum: null },
|
||||
];
|
||||
const { container, unmount } = renderIntoContainer(
|
||||
<ServiceLinesTable
|
||||
serviceLines={[line]}
|
||||
lineReconciliation={lineReconciliation}
|
||||
/>
|
||||
);
|
||||
const row = container.querySelector('[data-testid="service-line-row"]');
|
||||
const paid = row?.querySelector('[data-testid="paid-cell"]');
|
||||
const adjustments = row?.querySelector('[data-testid="adjustments-cell"]');
|
||||
expect(paid?.textContent ?? "").toBe("—");
|
||||
expect(adjustments?.textContent ?? "").toBe("—");
|
||||
unmount();
|
||||
});
|
||||
|
||||
it("test_multiple_lines_render_in_order", () => {
|
||||
const lines = [
|
||||
makeLine({ lineNumber: 1, procedureCode: "99213" }),
|
||||
|
||||
Reference in New Issue
Block a user