Nur für diesen Vorgang zählt der Freitag als Arbeitstag (Dauer, Ende, Nachfolger, Auslastung, Kalender-Abo, Wer macht was, Einsätze am Handy). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AmyPfuNc4sCRfaF3oURXZz
45 lines
2.6 KiB
TypeScript
45 lines
2.6 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]);
|
|
});
|
|
|
|
it("freigegebener Freitag: nur der Vorgang, der ihn freigegeben hat", () => {
|
|
const tage = ["2026-11-12", "2026-11-13", "2026-11-16"];
|
|
const vg = [
|
|
{ id: "v1", name: "Richten", anfang: "2026-11-12", ende: "2026-11-16", projekt: "P-26-014", freitage: ["2026-11-13"] },
|
|
{ id: "v2", name: "Dach", anfang: "2026-11-12", ende: "2026-11-16", projekt: "P-26-015" },
|
|
];
|
|
const bs = [{ vorgang_id: "v1", kontakt_id: "k1", personen: 1, freigegeben: true, anzeige: "Jan", kurz: "J" },
|
|
{ vorgang_id: "v2", kontakt_id: "k2", personen: 1, freigegeben: true, anzeige: "Tim", kurz: "T" }];
|
|
const m = einsatzMatrix(vg, bs, tage, W);
|
|
expect(m.zeilen.map((z) => z.tage.map((t) => t.length))).toEqual([[1, 1, 1], [1, 0, 1]]);
|
|
});
|
|
});
|