Remove global_chat dependency in restart test

Use a fictional restart_test mock plugin added as a before step instead
of global_chat for the .checkRestartRequired() test.  Prevents the test
from failing if the integration tests are not also run.

Also fixes the fixture not accounting for setting load_plugin causing
restartRequired to be set to true due to the integration tests having
already set it to the same value.
This commit is contained in:
Hornwitser committed 2026-09-11 19:51:16 +02:00
1 parent 30083b96c1
commit 511b8b7d97
2 files changed
+13 -6

No files matched your search

+5 -2
View File
@@ -119,10 +119,13 @@ describe("Host testing", function() {
describe(".checkRestartRequired()", function() {
let host;
const hostVersion = require("@clusterio/host/package.json").version;
before(function() {
lib.addPluginConfigFields([{ name: "restart_test", hostEntrypoint: "host.js" }]);
});
beforeEach(function() {
// This can be used more generally, but i did not want to interfere with handleSyncUserListsEvent
const pluginInfos = [{
name: "global_chat",
name: "restart_test",
packagePath: require.resolve("@clusterio/host/package.json"),
version: hostVersion,
}];
@@ -141,7 +144,7 @@ describe("Host testing", function() {
host.pluginInfos[0].version = "0.0.0";
host.pluginInfos[0].hostEntrypoint = true;
host.pluginInfos[0].instanceEntrypoint = true;
host.config.set("global_chat.load_plugin", false);
host.config.set("restart_test.load_plugin", false);
host.config.restartRequired = false; // Setting load_plugin requires a restart
const result = await host.checkRestartRequired();
assert.equal(result, false);