Move filepath into config class

This commit is contained in:
Cooldude2606 committed 2025-05-12 21:30:48 +01:00
1 parent c650f42276
commit 17db53403a
12 files changed
+51 -62

No files matched your search

+1 -1
View File
@@ -28,7 +28,7 @@ describe("controller/src/Controller", function() {
/** @type {Controller} */
let controller, mockInstanceConfig;
before(async function() {
controller = new Controller({}, [], "", new ControllerConfig("controller"));
controller = new Controller({}, [], new ControllerConfig("controller"));
mockInstanceConfig = new MockInstanceConfig(new Map([
["instance.id", 100], ["instance.name", "test"], ["factorio.settings", []],
]));
+1 -1
View File
@@ -10,7 +10,7 @@ describe("controller/src/WsServer", function() {
before(function() {
let config = new ControllerConfig("controller");
config.set("controller.trusted_proxies", "127.0.0.0/8, ::1");
let controller = new Controller({}, [], "", config);
let controller = new Controller({}, [], config);
wsServer = controller.wsServer;
});
describe(".remoteAddr()", function() {
+7 -6
View File
@@ -10,13 +10,14 @@ const { _discoverInstances } = require("@clusterio/host/dist/node/src/Host");
describe("Host testing", function() {
describe("discoverInstances()", function() {
it("should discover test instance", async function() {
let instancePath = path.join("test", "file", "instances");
let instanceInfos = await _discoverInstances(instancePath);
const instancePath = path.join("test", "file", "instances");
const instanceInfos = await _discoverInstances(instancePath);
let referenceConfig = new lib.InstanceConfig("host");
referenceConfig.set("instance.id", 1);
referenceConfig.set("instance.name", "test");
referenceConfig.dirty = false;
const configPath = path.join(instancePath, "test", "instance.json");
const referenceConfig = new lib.InstanceConfig("host", {
"instance.id": 1,
"instance.name": "test",
}, configPath);
assert.deepEqual(instanceInfos, new Map([
[1, {
+2 -7
View File
@@ -23,7 +23,7 @@ function connectHost(controller, hostId, plugins) {
controller.wsServer.hostConnections.set(hostId, hostConnection);
const hostConfig = new lib.HostConfig("host");
hostConfig.set("host.id", hostId);
return new Host(hostSide, "invalid", hostConfig, undefined, []);
return new Host(hostSide, hostConfig, undefined, []);
}
/**
@@ -107,12 +107,7 @@ describe("Integration of link routing", function() {
let controlB;
beforeEach(function() {
controller = new Controller(
{},
[],
"invalid",
new lib.ControllerConfig("controller")
);
controller = new Controller({}, [], new lib.ControllerConfig("controller"));
hostA = connectHost(controller, 10, []);
hostB = connectHost(controller, 20, []);
instanceA1 = connectInstance(controller, hostA, 11);