mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-11 23:04:52 +09:00
# Conflicts: # packages/lib/src/data/messages_plugin.ts # packages/web_ui/src/components/PluginViewPage.tsx # test/lib/plugin.js
28 lines
1.1 KiB
JavaScript
28 lines
1.1 KiB
JavaScript
import assert from "node:assert/strict";
|
|
|
|
import * as lib from "@clusterio/lib";
|
|
|
|
|
|
describe("lib/plugin", function() {
|
|
describe("pluginNeedsWebBuild()", function() {
|
|
it("should be false for plugins with only host, instance or ctl code", function() {
|
|
assert.equal(lib.pluginNeedsWebBuild({ name: "foo", title: "Foo" }), false);
|
|
assert.equal(lib.pluginNeedsWebBuild({
|
|
name: "foo", title: "Foo", hostEntrypoint: "host.js", instanceEntrypoint: "instance.js",
|
|
ctlEntrypoint: "ctl.js", messages: [],
|
|
}), false);
|
|
});
|
|
it("should be true for plugins with web or controller code or config fields", function() {
|
|
assert.equal(lib.pluginNeedsWebBuild({ name: "foo", title: "Foo", webEntrypoint: "web.js" }), true);
|
|
assert.equal(lib.pluginNeedsWebBuild({
|
|
name: "foo", title: "Foo", controllerEntrypoint: "controller.js",
|
|
}), true);
|
|
for (const field of [
|
|
"controllerConfigFields", "hostConfigFields", "instanceConfigFields", "controlConfigFields",
|
|
]) {
|
|
assert.equal(lib.pluginNeedsWebBuild({ name: "foo", title: "Foo", [field]: {} }), true, field);
|
|
}
|
|
});
|
|
});
|
|
});
|