fix(financial): say "supplier" when one supplier is owed
The "Received this month" sub-line always said "suppliers", so a single supplier read as "Owed to 1 suppliers". Use the singular when the count is 1. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
9fbfba891a
commit
84816fa466
2 changed files with 12 additions and 1 deletions
|
|
@ -191,6 +191,17 @@ it("counts only deliveries received this month, and names the suppliers owed", a
|
|||
expect(html).toContain('/dashboard/financial/suppliers?site=site1');
|
||||
});
|
||||
|
||||
it("says 'supplier' when only one supplier is owed", async () => {
|
||||
setup({
|
||||
pos: [{ id: "po1", site: "site1", supplier_ref: "s1", processing_status: "processed", total_value: 1000, date_uploaded: "2026-10-01 00:00:00.000Z" }],
|
||||
items: [{ id: "i1", purchase_order: "po1", qty: 10, rate: 100 }],
|
||||
dnItems: [{ id: "d1", purchase_order_item: "i1", qty_received: 4, delivery_note: "dn1" }],
|
||||
notes: [{ id: "dn1", document_type: "delivery_note", date_received: "2026-10-02 00:00:00.000Z" }],
|
||||
});
|
||||
const html = await renderPage();
|
||||
expect(tileSub(html, "Received this month")).toBe("Owed to 1 supplier for this month");
|
||||
});
|
||||
|
||||
it("says so plainly when nothing has been received yet this month", async () => {
|
||||
setup({ pos: [], items: [], dnItems: [], notes: [] });
|
||||
const html = await renderPage();
|
||||
|
|
|
|||
|
|
@ -210,7 +210,7 @@ export default async function FinancialLanding({
|
|||
label="Received this month"
|
||||
value={formatCurrency(summary.receivedValue)}
|
||||
sub={summary.owedSupplierCount > 0
|
||||
? `Owed to ${formatNumber(summary.owedSupplierCount)} suppliers for this month`
|
||||
? `Owed to ${formatNumber(summary.owedSupplierCount)} ${summary.owedSupplierCount === 1 ? "supplier" : "suppliers"} for this month`
|
||||
: "Nothing received yet this month"}
|
||||
icon={Package}
|
||||
/>
|
||||
|
|
|
|||
Loading…
Reference in a new issue