import test from "node:test"; import assert from "node:assert/strict"; import { readFile } from "node:fs/promises"; const html = await readFile(new URL("../public/index.html", import.meta.url), "utf8"); const app = await readFile(new URL("../public/app.js", import.meta.url), "utf8"); const css = await readFile(new URL("../public/styles.css", import.meta.url), "utf8"); const server = await readFile(new URL("../src/server.js", import.meta.url), "utf8"); test("desktop exposes a semi-automatic duty panel", () => { assert.match(html, /id="duty-panel"/); assert.match(html, /id="duty-run-now"/); assert.match(html, /id="duty-auto-retry"/); assert.match(html, /id="duty-auto-collect"/); assert.match(html, /id="duty-auto-export"/); assert.match(css, /\.duty-panel/); }); test("desktop duty panel loads and saves settings", () => { assert.match(app, /loadDutySettings/); assert.match(app, /saveDutySettings/); assert.match(app, /runDutyNow/); assert.match(app, /getJson\("\/api\/duty-settings"\)/); assert.match(app, /postJson\("\/api\/duty-settings"/); assert.match(app, /postJson\("\/api\/duty-run"/); }); test("server exposes duty settings and manual run APIs", () => { assert.match(server, /\/api\/duty-settings/); assert.match(server, /\/api\/duty-status/); assert.match(server, /\/api\/duty-run/); assert.match(server, /readDutySettings/); assert.match(server, /writeDutySettings/); assert.match(server, /runDutyJob/); assert.match(server, /startDutyScheduler/); assert.match(server, /setInterval/); });