21 lines
941 B
JavaScript
21 lines
941 B
JavaScript
import assert from "node:assert/strict";
|
|
import { readFileSync } from "node:fs";
|
|
import { test } from "node:test";
|
|
import { validateModule, validateSymconPackage } from "./validate-package.mjs";
|
|
|
|
const module = JSON.parse(readFileSync(new URL("../NextFloor/module.json", import.meta.url), "utf8"));
|
|
|
|
test("the shipped library contains a discoverable NextFloor module and its browser bundles", () => {
|
|
const installed = validateSymconPackage();
|
|
assert.deepEqual(installed.modules.map((entry) => entry.id), [module.id]);
|
|
});
|
|
|
|
test("a visualization module type cannot silently hide the PHP device from Add instance", () => {
|
|
assert.throws(() => validateModule({ ...module, type: 6 }), /supported PHP module type/);
|
|
});
|
|
|
|
test("the missing documentation URL reported by the official schema is rejected", () => {
|
|
const { url, ...incomplete } = module;
|
|
assert.throws(() => validateModule(incomplete), /missing required field 'url'/);
|
|
});
|