35 lines
1.3 KiB
JavaScript
35 lines
1.3 KiB
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";
|
|
import { bundleEntry } from "./bundle-entry.mjs";
|
|
|
|
test("HF APRS entry uses shared typed normalization and local symbols", async () => {
|
|
const window = { trxUi: { confirm: async () => true } };
|
|
const context = vm.createContext({
|
|
window,
|
|
document: { getElementById: () => null, querySelectorAll: () => [] },
|
|
navigator: {},
|
|
Date,
|
|
Number,
|
|
String,
|
|
Array,
|
|
Set,
|
|
Reflect,
|
|
console,
|
|
});
|
|
const runtime = await readFile(new URL("../../assets/web/generated/plugin-runtime.js", import.meta.url), "utf8");
|
|
const source = await bundleEntry(new URL("../src/plugins/hf-aprs.ts", import.meta.url));
|
|
assert.equal(source.includes("raw.githubusercontent.com"), false);
|
|
new vm.Script(runtime).runInContext(context);
|
|
new vm.Script(source).runInContext(context);
|
|
|
|
window.trxPluginRuntime.dispatch("hf_aprs", { src_call: "SP0ABC", dest_call: "APRS", crc_ok: true, symbol_table: "/", symbol_code: ">" });
|
|
assert.equal(window.onServerHfAprs, undefined);
|
|
assert.equal(window.trxPluginRuntime.hasDecoder("hf_aprs"), true);
|
|
});
|