16 lines
660 B
JavaScript
16 lines
660 B
JavaScript
import assert from "node:assert/strict";
|
|
import test from "node:test";
|
|
import { dateFromInput, plainTextToNoteHtml } from "../src/apple-events.js";
|
|
|
|
test("plainTextToNoteHtml escapes input and preserves line breaks", () => {
|
|
assert.equal(
|
|
plainTextToNoteHtml("R&D <today>", 'First\n"second"'),
|
|
"<h1>R&D <today></h1><div>First<br>"second"</div>",
|
|
);
|
|
});
|
|
|
|
test("dateFromInput accepts valid datetimes and rejects invalid input", () => {
|
|
assert.equal(dateFromInput("2026-05-26T10:00:00-04:00", "start").toISOString(), "2026-05-26T14:00:00.000Z");
|
|
assert.throws(() => dateFromInput("not-a-date", "start"), /valid ISO-8601/);
|
|
});
|