Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AmyPfuNc4sCRfaF3oURXZz
33 lines
1.8 KiB
TypeScript
33 lines
1.8 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { aufgabenGruppen, einsatzMatrix, naechsteArbeitstage } from "../src/domain/uebersicht.js";
|
|
import { STANDARDWOCHE as W } from "../src/domain/kalender.js";
|
|
|
|
describe("Aufgaben wie in V70 gruppiert", () => {
|
|
const a = (id: string, faellig_am: string | null, extra = {}) => ({ id, text: id, faellig_am, ...extra });
|
|
it("überfällig, diese Woche bis Sonntag, langfristig; erledigte fallen weg", () => {
|
|
// Mittwoch, 21.10.2026
|
|
const g = aufgabenGruppen([a("alt", "2026-10-20"), a("so", "2026-10-25"), a("mo", "2026-10-26"), a("ohne", null), a("fertig", "2026-10-21", { erledigt_am: "x" }), a("lang", "2026-10-22", { langfristig: true })], "2026-10-21");
|
|
expect(g.ueberfaellig.map((x) => x.id)).toEqual(["alt"]);
|
|
expect(g.dieseWoche.map((x) => x.id)).toEqual(["so"]);
|
|
expect(g.langfristig.map((x) => x.id)).toEqual(["lang", "mo", "ohne"]);
|
|
});
|
|
});
|
|
|
|
describe("Wer macht was", () => {
|
|
it("nächste Arbeitstage ohne Freitag und Feiertag", () => {
|
|
expect(naechsteArbeitstage("2026-10-29", 3, W)).toEqual(["2026-10-29", "2026-11-02", "2026-11-03"]);
|
|
});
|
|
it("Person je Zeile, Vorgänge ohne Besetzung extra", () => {
|
|
const tage = ["2026-10-19", "2026-10-20", "2026-10-21"];
|
|
const vg = [
|
|
{ id: "v1", name: "Abbund", anfang: "2026-10-19", ende: "2026-10-20", projekt: "P-26-014 Bohlentausch" },
|
|
{ id: "v2", name: "Montage", anfang: "2026-10-21", ende: "2026-10-22", projekt: "P-26-015 Anbau" },
|
|
];
|
|
const bs = [{ vorgang_id: "v1", kontakt_id: "k1", personen: 1, freigegeben: true, anzeige: "Henning", kurz: "HS" }];
|
|
const m = einsatzMatrix(vg, bs, tage);
|
|
expect(m.zeilen).toHaveLength(1);
|
|
expect(m.zeilen[0]!.tage.map((t) => t.map((x) => x.name))).toEqual([["Abbund"], ["Abbund"], []]);
|
|
expect(m.ohne.tage.map((t) => t.length)).toEqual([0, 0, 1]);
|
|
});
|
|
});
|