Merge remote-tracking branch 'upstream/master' into fix/instance-config-change-crash

This commit is contained in:
bbassie committed 2026-09-13 17:09:02 +00:00
commit 767f9e7fe3
16 files changed
+410 -27

No files matched your search

+33
View File
@@ -483,4 +483,37 @@ describe("class Instance", function() {
}
});
});
describe("_watchServerLogActions()", function() {
beforeEach(function() {
instance.config.set("factorio.sync_banlist", "bidirectional");
instance._watchServerLogActions();
});
afterEach(function() {
clearInterval(instance._playerCheckInterval);
});
function emitAction(action, message) {
instance.server.emit("output", { type: "action", action, message }, "");
}
it("should record a normal JOIN action", function() {
emitAction("JOIN", "player joined the game");
assert(instance.playersOnline.has("player"), "player was not added");
});
it("should parse the reason of a normal BAN action", function() {
emitAction("BAN", "player was banned by <server>. Reason: griefing.");
assert.deepEqual(
connector.sentMessages[0],
new lib.MessageEvent(
1, src, addr("allInstances"), "InstanceBanlistUpdateEvent",
new lib.InstanceBanlistUpdateEvent("player", true, "griefing"),
),
);
});
it("should not throw on a BAN action without a reason tail", function() {
assert.doesNotThrow(() => emitAction("BAN", "evil"));
});
it("should not throw on an action whose message starts with a space", function() {
assert.doesNotThrow(() => emitAction("JOIN", " "));
});
});
});