import { describe, expect, it } from "vitest"; import { invoiceFileName, invoiceFolderPath, methodFolder, monthLabel } from "./invoice-filing.js"; describe("раскладка инвойсов на Drive (как «07. Invoices»)", () => { it("месяц и имя файла", () => { expect(monthLabel(new Date("2026-11-30T00:00:00Z"))).toBe("November 2026"); expect(invoiceFileName(1500, "ACME Plumbing LLC", "inv.PDF")).toBe("$1,500.00 ACME Plumbing LLC.pdf"); expect(invoiceFileName(null, "A/B", "x.pdf")).toBe("A B.pdf"); }); it("до оплаты - «Без оплаты», после - по счёту оплаты без номера", () => { const d = new Date("2026-03-05T00:00:00Z"); expect(invoiceFolderPath(null, d)).toEqual(["Инвойсы", "Без оплаты", "March 2026"]); expect(invoiceFolderPath("Capital One 2381", d)).toEqual(["Инвойсы", "Capital One", "March 2026"]); expect(methodFolder("Bank of America (4455)")).toBe("Bank of America"); expect(methodFolder("Amex")).toBe("Amex"); }); });