import { describe, it, expect } from "vitest"; import { splitGrossCents } from "@/src/modules/zahlungen/lib/invoice-tax"; describe("splitGrossCents", () => { it("rechnet 19 % aus einem Endpreis heraus", () => { // 29,00 € brutto = 24,37 € netto + 4,63 € USt expect(splitGrossCents(2900, 19)).toEqual({ netCents: 2437, taxCents: 463 }); }); it("rechnet 7 % heraus", () => { expect(splitGrossCents(2900, 7)).toEqual({ netCents: 2710, taxCents: 190 }); }); it("ergibt immer exakt den Bruttobetrag", () => { for (const gross of [1, 99, 1250, 1999, 25000]) { const { netCents, taxCents } = splitGrossCents(gross, 19); expect(netCents + taxCents).toBe(gross); } }); });