Расширить proof matrix маржинальности follow-up replay

This commit is contained in:
2026-05-24 18:23:04 +03:00
parent f69393a887
commit 7cc65e808e
6 changed files with 436 additions and 8 deletions
@@ -641,4 +641,64 @@ describe("address reply builders regressions", () => {
expect(result?.text).not.toContain("Самая маржинальная позиция");
expect(result?.text).not.toMatch(/(?:оплат[аы]|банк|payment_document).{0,80}(?:источник|достаточ|посчитал|марж[ау])/iu);
});
it("acknowledges account 41 guard before repeating margin ranking", () => {
const result = composeInventoryReply(
"inventory_margin_ranking_for_nomenclature",
[
{
kind: "sale",
amount: 10800,
quantity: 1,
item: "Флаг геральдический",
period: "2017-05-20",
registrator: "Реализация товаров"
} as any,
{
kind: "purchase",
amount: 8520,
quantity: 1,
item: "Флаг геральдический",
period: "2017-01-10",
registrator: "Поступление товаров"
} as any
],
{
userMessage: "Анализ по 41 счету, а не по 01.",
periodFrom: "2017-01-01",
periodTo: "2017-12-31"
},
{
resolvePayablesAsOfDate: () => "2017-12-31",
buildInventoryOnHandAggregate: () => [],
uniqueStrings: (values: string[]) => Array.from(new Set(values)),
formatDateRu: (value: string) => value,
formatNumberWithDots: (value: number, fractionDigits = 0) => value.toFixed(fractionDigits),
formatMoneyRub: (value: number) => `${value}`,
isInventoryPurchaseMovement: (row: any) => row.kind === "purchase",
summarizeInventoryTraceRows: (rows: any[]) => ({
item: rows[0]?.item ?? null,
warehouses: [],
organizations: [],
counterparties: [],
documents: [],
firstPeriod: null,
lastPeriod: null,
totalAmount: 0
}),
formatInventoryTraceRows: () => [],
hasInventoryPurchaseDateActionFocus: () => false,
inventoryTraceDateLabel: () => "",
extractInventoryCounterpartyCandidates: () => [],
buildInventoryAgingByItemAggregate: () => [],
formatInventoryAgingRows: () => [],
isInventorySaleMovement: (row: any) => row.kind === "sale"
}
);
const firstLine = result?.text.split("\n")[0] ?? "";
expect(firstLine).toContain("По счету 41, не по 01/ОС");
expect(firstLine).toContain("Самая маржинальная позиция");
expect(result?.text).not.toContain("амортизац");
});
});