Инвойсы на Drive: раскладка как в «07. Invoices» (Инвойсы / способ оплаты / Месяц ГГГГ / «$сумма Вендор.pdf»), перенос оплаченных; drive_folder
Some checks failed
ci / test (push) Failing after 59s
ci / deploy (push) Has been skipped

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-30 23:27:04 +03:00
parent dd60da4091
commit db333d6750
7 changed files with 122 additions and 4 deletions

View File

@@ -0,0 +1,17 @@
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");
});
});