9958e00abc
Rectification stays optional. Reported minutes can consult and generate reports; date-plus-period uses a declared window instead of a midpoint or 00:00. Updates BUG-341. Co-authored-by: Cursor <cursoragent@cursor.com>
37 lines
1.3 KiB
TypeScript
37 lines
1.3 KiB
TypeScript
import assert from "node:assert/strict";
|
|
import test from "node:test";
|
|
|
|
import {
|
|
DECLARED_PERIOD_RANGES,
|
|
declaredClockRange,
|
|
declaredWindowProbeClocks,
|
|
} from "../src/lib/declared-birth-window.ts";
|
|
|
|
test("evening probes stay inside the declared range and are not the midpoint", () => {
|
|
const range = DECLARED_PERIOD_RANGES.evening;
|
|
const clocks = declaredWindowProbeClocks(range.startTime, range.endTime);
|
|
|
|
assert.deepEqual(clocks, ["18:00", "19:40", "21:19", "22:59"]);
|
|
assert.equal(clocks.includes("20:29"), false);
|
|
assert.equal(clocks.includes("20:30"), false);
|
|
assert.equal(clocks.includes("12:00"), false);
|
|
assert.equal(clocks.includes("00:00"), false);
|
|
});
|
|
|
|
test("unknown-day probes keep midnight as a sample, not as a birth minute", () => {
|
|
const range = declaredClockRange({ source: "unknown" });
|
|
assert.ok(range);
|
|
const clocks = declaredWindowProbeClocks(range.startTime, range.endTime);
|
|
assert.equal(clocks[0], "00:00");
|
|
assert.equal(clocks.at(-1), "23:59");
|
|
assert.equal(clocks.length, 4);
|
|
});
|
|
|
|
test("period_only without a period cannot invent a clock range", () => {
|
|
assert.equal(declaredClockRange({ source: "period_only" }), null);
|
|
assert.deepEqual(
|
|
declaredClockRange({ source: "period_only", period: "evening" }),
|
|
DECLARED_PERIOD_RANGES.evening,
|
|
);
|
|
});
|