mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-16 23:30:41 +09:00
Add tests for new config value
This commit is contained in:
1 parent
762212747e
commit
c5841b17a0
5 files changed
+26
-3
No files matched your search
@@ -442,6 +442,10 @@ describe("Integration of Clusterio", function() {
|
||||
});
|
||||
|
||||
describe("instance send-rcon", function() {
|
||||
this.afterAll(async function() {
|
||||
// Prevents cascading failure where enable_script_commands is expected to be true
|
||||
await execCtl("instance config set test factorio.enable_script_commands true");
|
||||
});
|
||||
it("sends the command", async function() {
|
||||
slowTest(this);
|
||||
await execCtl("instance send-rcon test technobabble");
|
||||
@@ -465,6 +469,24 @@ describe("Integration of Clusterio", function() {
|
||||
}
|
||||
assert(received, "InstanceSaveDetailsUpdatesEvent not sent");
|
||||
});
|
||||
it("should prevent execution of script commands when disabled", async function() {
|
||||
slowTest(this);
|
||||
await execCtl("instance send-rcon test /c");
|
||||
const r1 = await getControl().send(
|
||||
new lib.LogQueryRequest(false, false, [], [44], undefined, 10, "desc")
|
||||
);
|
||||
assert(r1.log.some(info => /\[COMMAND\]/.test(info.message)), "Command was not sent");
|
||||
await execCtl("instance config set test factorio.enable_script_commands false");
|
||||
|
||||
assert.rejects(
|
||||
execCtl("instance send-rcon test /c"),
|
||||
new Error(
|
||||
"Attempted to use script command while disabled. " +
|
||||
"See config factorio.enable_script_commands.\nCommand: /c"
|
||||
)
|
||||
);
|
||||
await execCtl("instance config set test factorio.enable_script_commands true");
|
||||
});
|
||||
});
|
||||
|
||||
describe("instance config set-prop", function() {
|
||||
|
||||
@@ -129,6 +129,7 @@ class MockInstance extends lib.Link {
|
||||
this.mockConfigEntries = new Map([
|
||||
["instance.id", 7357],
|
||||
["factorio.enable_save_patching", true],
|
||||
["factorio.enable_script_commands", true],
|
||||
]);
|
||||
this.config = {
|
||||
get: (name) => {
|
||||
|
||||
Reference in new issue
Block a user