Files
Hornwitser 5df5af7ca8 Rename Ctl's usage of "control" to "ctl" (#1039)
Ctl ended up calling its main class for "Control" for historical
reasons, along with its config file and plugin entrypoint.

The plugin entrypoint was renamed to ctl in 808eda0513.  This
finishes that renaming by also renaming the main class, default config
file, config-control command, and main entrypoint.

The config-control command is renamed to config to be consistent with
the host and controller's config commands.

The term "control" is still kept in the config and message locations as
a common specifier for both ctl and web_ui.
2026-09-14 20:18:41 +02:00

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", "ctlConfigFields",
]) {
assert.equal(lib.pluginNeedsWebBuild({ name: "foo", title: "Foo", [field]: {} }), true, field);
}
});
});
});