30 lines
969 B
JavaScript
30 lines
969 B
JavaScript
// SPDX-FileCopyrightText: 2026 Stan Grams <sjg@haxx.space>
|
|
//
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
import assert from "node:assert/strict";
|
|
import { readFile } from "node:fs/promises";
|
|
import test from "node:test";
|
|
import vm from "node:vm";
|
|
|
|
test("satellite scheduler exposes a typed config adapter with safe defaults", async () => {
|
|
const window = {};
|
|
const context = vm.createContext({
|
|
window,
|
|
document: { getElementById: () => null, createDocumentFragment: () => ({ appendChild() {} }) },
|
|
Date,
|
|
Number,
|
|
String,
|
|
Array,
|
|
console,
|
|
});
|
|
const source = await readFile(new URL("../../assets/web/generated/sat-scheduler.js", import.meta.url), "utf8");
|
|
new vm.Script(source).runInContext(context);
|
|
|
|
assert.equal(typeof window.satScheduler.wireEvents, "function");
|
|
assert.deepEqual(
|
|
JSON.parse(JSON.stringify(window.satScheduler.collectSatelliteConfig())),
|
|
{ enabled: false, pretune_secs: 60, entries: [] },
|
|
);
|
|
});
|