mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-21 08:03:13 +09:00
Merge remote-tracking branch 'upstream/master' into refactor/plugin-hooks-v2
# Conflicts: # packages/lib/src/data/messages_plugin.ts # packages/web_ui/src/components/PluginViewPage.tsx # test/lib/plugin.js
This commit is contained in:
commit
db84455c34
37 files changed
+573
-60
No files matched your search
@@ -0,0 +1,27 @@
|
||||
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);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user