- Honey batch create omits an empty batch number (was 400); product form
labels the legacy total weight, detail shows jar weight and shelf life;
bottling hints next to their fields, values cleared on product change,
post-save water-content wording; withdraw reason placeholder not
selectable; honey batch actions offline-disabled with reason, 44 px.
- Offline signal: one slow request no longer flips the app offline; two
consecutive timeouts do, any HTTP answer clears it, aborts never count.
- Phenology sheet as a side card on desktop with focus return; confirm
dialogs as alertdialog; step-up texts in du-form ("Das Passwort stimmt
nicht."); backup import gives its disabled reason; missing event labels
plus a guard test; profile buttons 44 px.
- GET /phenology/state returns intervalDays via the shared
inspectionIntervalOf (autopilot, digest, season state use one source).
- T6 plan aligned with the code after T4, plus owner decisions of
2026-10-15 (Berlin day for restrictions, COMPLIANCE category, override
without step-up).
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
90 lines
3.1 KiB
TypeScript
90 lines
3.1 KiB
TypeScript
import { DEFAULT_INSPECTION_INTERVAL_CONFIG } from '../automation/rule-config/inspection-interval.config';
|
|
import { inspectionDueOn, inspectionIntervalOf } from './inspection-due';
|
|
|
|
const CONFIG = DEFAULT_INSPECTION_INTERVAL_CONFIG;
|
|
const SCHWARMZEIT = {
|
|
segment: 'SCHWARMZEIT',
|
|
springSince: '2026-03-20',
|
|
} as const;
|
|
|
|
describe('inspectionDueOn', () => {
|
|
it('adds the interval of the current segment to the last inspection', () =>
|
|
expect(
|
|
inspectionDueOn(
|
|
{ createdOn: '2025-06-01', lastInspectedOn: '2026-05-05' },
|
|
SCHWARMZEIT,
|
|
CONFIG,
|
|
),
|
|
).toEqual({ dueOn: '2026-05-12', firstOfYear: false, intervalDays: 7 }));
|
|
|
|
it('uses the interval of SOMMER in SOMMER', () =>
|
|
expect(
|
|
inspectionDueOn(
|
|
{ createdOn: '2025-06-01', lastInspectedOn: '2026-06-25' },
|
|
{ segment: 'SOMMER', springSince: '2026-03-20' },
|
|
CONFIG,
|
|
),
|
|
).toEqual({ dueOn: '2026-07-09', firstOfYear: false, intervalDays: 14 }));
|
|
|
|
it('returns null in WINTERRUHE', () =>
|
|
expect(
|
|
inspectionDueOn(
|
|
{ createdOn: '2025-06-01', lastInspectedOn: '2025-10-01' },
|
|
{ segment: 'WINTERRUHE', springSince: null },
|
|
CONFIG,
|
|
),
|
|
).toBeNull());
|
|
|
|
it('counts from createdAt without any inspection', () =>
|
|
expect(
|
|
inspectionDueOn(
|
|
{ createdOn: '2026-04-20', lastInspectedOn: null },
|
|
SCHWARMZEIT,
|
|
CONFIG,
|
|
),
|
|
).toEqual({ dueOn: '2026-04-27', firstOfYear: false, intervalDays: 7 }));
|
|
|
|
it('is due from the start of FRUEHJAHR when the last inspection was before it (first of the year)', () =>
|
|
expect(
|
|
inspectionDueOn(
|
|
{ createdOn: '2025-06-01', lastInspectedOn: '2025-10-30' },
|
|
{ segment: 'FRUEHJAHR', springSince: '2026-03-20' },
|
|
CONFIG,
|
|
),
|
|
).toEqual({ dueOn: '2026-03-20', firstOfYear: true, intervalDays: 14 }));
|
|
|
|
it('a colony created before the spring without an inspection is first-of-year due too', () =>
|
|
expect(
|
|
inspectionDueOn(
|
|
{ createdOn: '2025-09-01', lastInspectedOn: null },
|
|
{ segment: 'FRUEHJAHR', springSince: '2026-03-20' },
|
|
CONFIG,
|
|
),
|
|
).toMatchObject({ dueOn: '2026-03-20', firstOfYear: true }));
|
|
|
|
it('an inspection on the first day of FRUEHJAHR counts as done', () =>
|
|
expect(
|
|
inspectionDueOn(
|
|
{ createdOn: '2025-06-01', lastInspectedOn: '2026-03-20' },
|
|
{ segment: 'FRUEHJAHR', springSince: '2026-03-20' },
|
|
CONFIG,
|
|
),
|
|
).toEqual({ dueOn: '2026-04-03', firstOfYear: false, intervalDays: 14 }));
|
|
});
|
|
|
|
describe('inspectionIntervalOf', () => {
|
|
const days = CONFIG.intervalDays;
|
|
|
|
it('is the configured interval of the segment', () => {
|
|
expect(inspectionIntervalOf('SCHWARMZEIT', days)).toBe(7);
|
|
expect(inspectionIntervalOf('SOMMER', days)).toBe(14);
|
|
expect(inspectionIntervalOf('HERBST', days)).toBe(21);
|
|
});
|
|
|
|
it('is null in WINTERRUHE', () =>
|
|
expect(inspectionIntervalOf('WINTERRUHE', days)).toBeNull());
|
|
|
|
it('is null while the rule is inactive', () =>
|
|
expect(inspectionIntervalOf('SCHWARMZEIT', days, false)).toBeNull());
|
|
});
|