toBe($bucket); })->with([ 'due yesterday' => ['2026-11-24', null, AgendaBucket::Overdue], 'due yesterday, started earlier' => ['2026-11-24', '2026-11-01', AgendaBucket::Overdue], 'due today' => ['2026-11-25', null, AgendaBucket::Soon], 'under way since Monday' => ['2026-12-10', '2026-11-23', AgendaBucket::Soon], 'starts tomorrow' => [null, '2026-11-26', AgendaBucket::Soon], 'due on Sunday' => ['2026-11-29', null, AgendaBucket::ThisWeek], 'starts next week' => [null, '2026-11-30', AgendaBucket::Later], 'no dates' => [null, null, AgendaBucket::Later], ]); it('counts working days without weekends and holidays', function () { expect(Workload::workingDays('2026-12-21', '2026-12-27', ['2026-12-24', '2026-12-25', '2026-12-26']))->toBe(3) ->and(Workload::workingDays('2026-11-23', '2026-11-29', []))->toBe(5); }); it('compares the workload with the capacity', function () { $load = Workload::of(2700, 480, 5); expect($load->capacityMinutes)->toBe(2400) ->and($load->ratio())->toBe(1.125) ->and($load->isOverloaded())->toBeTrue() ->and(Workload::of(0, 480, 0)->ratio())->toBeNull() ->and(Workload::of(2400, 480, 5)->isOverloaded())->toBeFalse(); }); it('gives the change from the earlier value, none from zero', function () { expect((new Change(150, 100))->ratio())->toBe(0.5) ->and((new Change(50, 100))->ratio())->toBe(-0.5) ->and((new Change(-50, -100))->ratio())->toBe(0.5) ->and((new Change(10, 0))->ratio())->toBeNull(); });