Files
ApiCore/ApiCore-Frontend/src/lib/system/labels.spec.ts
T
Nick SzaunigandClaude Opus 5.5 cdd30cf3ee feat: platform backbone and field capture complete (checkpoint)
Platform backbone (plan 2026-10-13-plattform-rueckgrat), all tasks reviewed:
- webhooks with delivery table, retries and stable delivery id
- calendar handlers; a finished task removes its Outlook event
- tasks, automations, inspections, varroa, treatments, feedings,
  harvests, colonies, wintering, stock and bottling record domain events
  in the same transaction; legacy post-commit calls removed
- row locks through one helper (lockRowForUpdate, lockRowsForShare,
  lockRowsForUpdate)
- job framework with JobRun, cli exit codes, cleanup, task templates,
  daily evaluation, hourly app-backup and the rekey job
- system API and page "Verwaltung > System" with retry
- @nestjs/schedule removed, guard tests against in-process schedulers

Field capture T3 (plan 2026-10-13-t3-erfassung-am-stand), all tasks reviewed:
- inspection photo offline without metadata
- bulk capture for treatments, feedings and varroa (backend + frontend)
- offline stand mode with service worker, offline pages and packs
- offline session, cold start and logout on shared devices

Docs: ARCHITECTURE.md assumptions and sections updated, TASKS.md.
Gates: backend lint, typecheck, 1770 unit, 420 e2e, build, no schema
drift; frontend lint, typecheck, 913 tests, build. Not rolled out.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
2026-10-14 11:36:38 +02:00

44 lines
1.4 KiB
TypeScript

import { describe, expect, it } from "vitest";
import {
DOMAIN_EVENT_LABELS,
JOB_LABELS,
JOB_RUN_STATUS_LABELS,
QUEUE_STALE_WARNING_SECONDS,
WEBHOOK_DELIVERY_STATUS_LABELS,
attemptsLabel,
formatAge,
} from "./labels";
import { JOB_NAMES } from "./types";
describe("system labels", () => {
it("labels every job", () => {
expect(JOB_NAMES.every((job) => JOB_LABELS[job].length > 0)).toBe(true);
expect(JOB_LABELS.cleanup).toBe("Aufräumen");
});
it("labels the run and delivery states", () => {
expect(JOB_RUN_STATUS_LABELS.FAILED).toBe("Fehlgeschlagen");
expect(WEBHOOK_DELIVERY_STATUS_LABELS.DELIVERED).toBe("Zugestellt");
expect(WEBHOOK_DELIVERY_STATUS_LABELS.PENDING).toBe("Offen");
expect(DOMAIN_EVENT_LABELS.InspectionRecorded).toBe("Durchsicht erfasst");
});
it("warns after ten minutes", () => {
expect(QUEUE_STALE_WARNING_SECONDS).toBe(600);
});
it("pluralises attempts", () => {
expect(attemptsLabel(1)).toBe("1 Versuch");
expect(attemptsLabel(0)).toBe("0 Versuche");
expect(attemptsLabel(8)).toBe("8 Versuche");
});
it("formats ages in German", () => {
expect(formatAge(5)).toBe("vor wenigen Sekunden");
expect(formatAge(180)).toBe("vor 3 Min.");
expect(formatAge(7300)).toBe("vor 2 Std.");
expect(formatAge(2 * 86400 + 10)).toBe("vor 2 Tagen");
expect(formatAge(86400)).toBe("vor 1 Tag");
});
});