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]>
This commit is contained in:
1 parent
c01a38835a
commit
cdd30cf3ee
288 files changed
+39165
-2853
No files matched your search
@@ -0,0 +1,47 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { colonyIdsOfBulkInput, withoutColonies } from "./bulk-input";
|
||||
|
||||
const TREATMENT = { date: "2026-10-14", product: "Oxuvar", colonyIds: ["a", "b", "c"] };
|
||||
const VARROA = {
|
||||
date: "2026-10-14",
|
||||
method: "NATURAL_MITE_FALL",
|
||||
entries: [
|
||||
{ colonyId: "a", miteCount: 4 },
|
||||
{ colonyId: "b", miteCount: 9 },
|
||||
],
|
||||
};
|
||||
|
||||
describe("colonyIdsOfBulkInput", () => {
|
||||
it("lists the colonies of every kind", () => {
|
||||
expect(colonyIdsOfBulkInput("treatments", TREATMENT)).toEqual(["a", "b", "c"]);
|
||||
expect(colonyIdsOfBulkInput("feedings", TREATMENT)).toEqual(["a", "b", "c"]);
|
||||
expect(colonyIdsOfBulkInput("varroa", VARROA)).toEqual(["a", "b"]);
|
||||
});
|
||||
|
||||
it("is empty for input of an unknown shape", () => {
|
||||
expect(colonyIdsOfBulkInput("treatments", null)).toEqual([]);
|
||||
expect(colonyIdsOfBulkInput("varroa", { entries: "x" })).toEqual([]);
|
||||
});
|
||||
});
|
||||
|
||||
describe("withoutColonies", () => {
|
||||
it("drops the colonies and keeps every shared field", () => {
|
||||
expect(withoutColonies("treatments", TREATMENT, ["b"])).toEqual({
|
||||
...TREATMENT,
|
||||
colonyIds: ["a", "c"],
|
||||
});
|
||||
});
|
||||
|
||||
it("drops a varroa colony together with its own count", () => {
|
||||
expect(withoutColonies("varroa", VARROA, ["a"])).toEqual({
|
||||
...VARROA,
|
||||
entries: [{ colonyId: "b", miteCount: 9 }],
|
||||
});
|
||||
});
|
||||
|
||||
it("does not change the input", () => {
|
||||
const before = structuredClone(TREATMENT);
|
||||
withoutColonies("treatments", TREATMENT, ["a"]);
|
||||
expect(TREATMENT).toEqual(before);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user