// SPDX-FileCopyrightText: 2026 Stan Grams // // SPDX-License-Identifier: GPL-2.0-or-later import assert from "node:assert/strict"; import test from "node:test"; import { readFile } from "node:fs/promises"; const indexPath = new URL("../../assets/web/index.html", import.meta.url); test("index loads the shared UI before the application", async () => { const html = await readFile(indexPath, "utf8"); assert.ok(html.indexOf("/ui-core.js") < html.indexOf("/app.js")); assert.ok(html.indexOf("/plugin-loader.js") < html.indexOf("/app.js")); assert.equal(html.includes("var pluginScripts"), false); }); test("startup has no remote script or stylesheet dependencies", async () => { const html = await readFile(indexPath, "utf8"); const assetReferences = Array.from( html.matchAll(/<(?:script|link)\b[^>]+(?:src|href)="([^"]+)"/g), (match) => match[1], ); assert.equal( assetReferences.some((reference) => /^https?:\/\//i.test(reference)), false, ); });