The order-details panel reads qty/description/amount from expense_metadata.line_items. A grocery shop is a receipt like any other, so it stores the same keys rather than name/quantity/line_total — otherwise the rows arrive complete and display blank, which is exactly the failure ING-8 names. unit and category are the two fields a grocery line has and a delivery line does not; nothing renders them yet and the category composition will.
This commit is contained in:
@@ -37,8 +37,8 @@ const colesSplit = () => ({
|
||||
{ leg_index: 2, amount: 73.82, card_last4: "3302", card_product: "MASTERCARD", class: "card" as const },
|
||||
],
|
||||
line_items: [
|
||||
{ name: "Pork Loin Roast", quantity: 1, unit: "ea", line_total: 15.86, category: "meat" },
|
||||
{ name: "Tomatoes", quantity: 1, unit: "ea", line_total: 98.71, category: "produce" },
|
||||
{ description: "Pork Loin Roast", qty: 1, unit: "ea", amount: 15.86, category: "meat" },
|
||||
{ description: "Tomatoes", qty: 1, unit: "ea", amount: 98.71, category: "produce" },
|
||||
],
|
||||
});
|
||||
|
||||
@@ -50,7 +50,7 @@ const woolworthsGiftCard = () => ({
|
||||
transaction_date: "2026-06-29",
|
||||
total: 40.75,
|
||||
tender_legs: [{ leg_index: 1, amount: 40.75, card_last4: "0443", card_product: "STORE CARD", class: "gift_card" as const }],
|
||||
line_items: [{ name: "Oat Milk", quantity: 2, unit: "ea", line_total: 40.75, category: "dairy" }],
|
||||
line_items: [{ description: "Oat Milk", qty: 2, unit: "ea", amount: 40.75, category: "dairy" }],
|
||||
});
|
||||
|
||||
beforeAll(async () => {
|
||||
@@ -197,7 +197,7 @@ describe("validation — what becomes money", () => {
|
||||
});
|
||||
|
||||
it("flags but accepts lines that do not sum, because promo rows are skipped by design", async () => {
|
||||
const res = await POST(req({ ...colesSplit(), line_items: [{ name: "One line", line_total: 10 }] }));
|
||||
const res = await POST(req({ ...colesSplit(), line_items: [{ description: "One line", amount: 10 }] }));
|
||||
expect(res.status).toBe(200);
|
||||
expect((await res.json()).flags.some((f: string) => f.startsWith("line_items_sum_"))).toBe(true);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user