Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AmyPfuNc4sCRfaF3oURXZz
23 lines
1.3 KiB
TypeScript
23 lines
1.3 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { kalender } from "../src/domain/ical.js";
|
|
import { arbeitsbloecke } from "../src/server/kalender.js";
|
|
import { STANDARDWOCHE as W } from "../src/domain/kalender.js";
|
|
|
|
describe("Kalender-Abo (T11)", () => {
|
|
it("ganztägige Termine, Ende am Folgetag, Sonderzeichen maskiert", () => {
|
|
const ics = kalender("Baustellen", [{ uid: "v1@x", von: "2026-10-26", bis: "2026-10-27", titel: "P-26-014 Abbund, Montage; HS" }], new Date("2026-10-19T08:00:00Z"));
|
|
expect(ics).toContain("DTSTART;VALUE=DATE:20261026\r\nDTEND;VALUE=DATE:20261028");
|
|
expect(ics).toContain("SUMMARY:P-26-014 Abbund\\, Montage\\; HS");
|
|
expect(ics).toContain("DTSTAMP:20261019T080000Z");
|
|
expect(ics.endsWith("END:VCALENDAR\r\n")).toBe(true);
|
|
});
|
|
it("lange Zeilen werden nach 75 Byte gefaltet", () => {
|
|
const ics = kalender("K", [{ uid: "u", von: "2026-10-26", bis: "2026-10-26", titel: "Ä".repeat(60) }]);
|
|
for (const z of ics.split("\r\n")) expect(new TextEncoder().encode(z).length).toBeLessThanOrEqual(75);
|
|
expect(ics.replace(/\r\n /g, "")).toContain("SUMMARY:" + "Ä".repeat(60));
|
|
});
|
|
it("Vorgang über Freitag und Wochenende wird in Arbeitsblöcke geteilt", () => {
|
|
expect(arbeitsbloecke("2026-10-21", "2026-10-27", W)).toEqual([["2026-10-21", "2026-10-22"], ["2026-10-26", "2026-10-27"]]);
|
|
});
|
|
});
|