Update hivegrid-cloud reference to latest main
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
e98d38e716
commit
7b21524c86
3781 files changed
+373484
-225607
No files matched your search
+29
@@ -0,0 +1,29 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { computeNextDue } from "./reminder-cadence.js";
|
||||
|
||||
// AK-P17b — cadence math is pure. Covers every cadence kind.
|
||||
|
||||
describe("computeNextDue", () => {
|
||||
const from = new Date("2026-01-15T00:00:00.000Z");
|
||||
|
||||
it("returns null for a one-off reminder", () => {
|
||||
expect(computeNextDue({ cadenceKind: "once", from })).toBeNull();
|
||||
});
|
||||
|
||||
it("advances a yearly reminder by 12 months", () => {
|
||||
const next = computeNextDue({ cadenceKind: "yearly", from })!;
|
||||
expect(next.getFullYear()).toBe(2027);
|
||||
expect(next.getMonth()).toBe(0);
|
||||
});
|
||||
|
||||
it("advances every_n_months by the interval (default 1)", () => {
|
||||
expect(computeNextDue({ cadenceKind: "every_n_months", intervalMonths: 3, from })!.getMonth()).toBe(3);
|
||||
expect(computeNextDue({ cadenceKind: "every_n_months", intervalMonths: null, from })!.getMonth()).toBe(1);
|
||||
});
|
||||
|
||||
it("uses the document expiry for on_expiry, null when absent", () => {
|
||||
const expiry = new Date("2026-06-30T00:00:00.000Z");
|
||||
expect(computeNextDue({ cadenceKind: "on_expiry", from, validUntil: expiry })).toEqual(expiry);
|
||||
expect(computeNextDue({ cadenceKind: "on_expiry", from, validUntil: null })).toBeNull();
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user