0.51.0: Zahlungsplan nach Auftragswert gestaffelt, Staffel in den Einstellungen
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AmyPfuNc4sCRfaF3oURXZz
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { describe, it, expect } from "vitest";
|
||||
import { prozentVon, brutto, parseEuro, formatEuro, zahlungsplanBetraege, STANDARD_ZAHLUNGSPLAN, summe, schlageZahlungsplanVor } from "../src/domain/geld.js";
|
||||
import { prozentVon, brutto, parseEuro, formatEuro, zahlungsplanBetraege, STANDARD_ZAHLUNGSPLAN, summe, schlageZahlungsplanVor, ratenFuer, STANDARD_STAFFEL } from "../src/domain/geld.js";
|
||||
import { stundenZuArbeitstagen } from "../src/domain/arbeitszeit.js";
|
||||
|
||||
describe("Prozent und Umsatzsteuer", () => {
|
||||
@@ -93,6 +93,18 @@ describe("Zahlungsplan als Meilensteine vorschlagen", () => {
|
||||
]);
|
||||
});
|
||||
|
||||
it("Anzahl der Raten nach Auftragswert: unter 10.000 € eine, bis 20.000 € zwei, darüber vier (Henning, 09.11.2026)", () => {
|
||||
expect(ratenFuer(999_999).map((r) => r.prozent)).toEqual([100]);
|
||||
expect(ratenFuer(1_000_000).map((r) => r.prozent)).toEqual([50, 50]);
|
||||
expect(ratenFuer(1_999_999)).toHaveLength(2);
|
||||
expect(ratenFuer(2_000_000).map((r) => r.prozent)).toEqual([30, 40, 20, 10]);
|
||||
expect(ratenFuer(500, [{ ab: 1000, raten: STANDARD_STAFFEL[1]!.raten }])).toHaveLength(2);
|
||||
const eine = schlageZahlungsplanVor(800_000, vs, "2026-10-20", ratenFuer(800_000));
|
||||
expect(eine.map((r) => [r.art, r.netto, r.vorgang_id])).toEqual([["schluss", 800_000, "abnahme"]]);
|
||||
const zwei = schlageZahlungsplanVor(1_500_001, vs, "2026-10-20", ratenFuer(1_500_001));
|
||||
expect(zwei.map((r) => [r.art, r.netto, r.vorgang_id])).toEqual([["abschlag", 750_001, "richten"], ["schluss", 750_000, "abnahme"]]);
|
||||
});
|
||||
|
||||
it("geht auch ohne passende Namen und ohne Vorgänge", () => {
|
||||
const z = schlageZahlungsplanVor(100_001, vs.slice(2, 4), "2026-12-01");
|
||||
expect(z.map((r) => r.vorgang_id)).toEqual([null, "dach", "rest", "rest"]);
|
||||
|
||||
Reference in New Issue
Block a user