const test = require("node:test");
const assert = require("node:assert/strict");
const { reminderMinutes, scheduledReminderAt } = require("../src/security/reminders");

test("reminders accept only supported offsets", () => {
  assert.equal(reminderMinutes(10), 10);
  assert.equal(reminderMinutes("1440"), 1440);
  assert.equal(reminderMinutes(7), 60);
});

test("absolute scheduling remains correct across DST offsets", () => {
  assert.equal(scheduledReminderAt("2026-11-01T06:30:00Z", 60).toISOString(), "2026-11-01T05:30:00.000Z");
  assert.equal(scheduledReminderAt("2026-03-08T07:30:00Z", 60).toISOString(), "2026-03-08T06:30:00.000Z");
});
