Files
pi-gui/test/noctalia-plugin.test.js

42 lines
1.3 KiB
JavaScript

import assert from "node:assert/strict";
import { readFile } from "node:fs/promises";
import test from "node:test";
test("ships a Noctalia aggregate launcher without a primary panel", async () => {
const manifestText = await readFile(
"noctalia-plugin/pi-status-bridge/manifest.json",
"utf8",
);
let manifest;
try {
manifest = JSON.parse(manifestText);
} catch (error) {
assert.fail(
error instanceof Error ? error.message : "manifest was not valid JSON",
);
}
const [bar, main] = await Promise.all([
readFile("noctalia-plugin/pi-status-bridge/BarWidget.qml", "utf8"),
readFile("noctalia-plugin/pi-status-bridge/Main.qml", "utf8"),
]);
assert.equal(manifest.id, "pi-status-bridge");
assert.deepEqual(manifest.entryPoints, {
main: "Main.qml",
barWidget: "BarWidget.qml",
});
assert.match(bar, /systemctl", "--user", "start", "pi-status-bridge\.service/);
assert.match(bar, /PI_STATUS_UI_BINARY/);
assert.match(bar, /pi-status-ui/);
assert.match(bar, /setsid -f env TMPDIR=\/tmp/);
assert.match(bar, /--toggle/);
assert.doesNotMatch(bar, /togglePanel/);
assert.doesNotMatch(bar, /Panel\.qml/);
assert.match(main, /IpcHandler/);
assert.match(main, /setBridgeState/);
assert.match(main, /openCount/);
assert.match(main, /workingCount/);
assert.match(main, /recoveringCount/);
assert.match(main, /errorCount/);
});