Cover the create-scenario command handler and module loading

Adds tests for handleCreateScenarioCommand using a fake Factorio
install with the test scenario as freeplay, for loadModules skipping
plugins without a module and rejecting a name clash with a bundled
module, and an integration test running clusteriohost create-scenario.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
bbassieandClaude Fable 5.1 committed 2026-09-10 00:36:35 +00:00
1 parent c419f3e9b2
commit 1072e5f1de
3 files changed
+128 -1

No files matched your search

+13
View File
@@ -257,6 +257,19 @@ describe("Integration of Clusterio", function() {
});
describe("clusteriohost", function() {
describe("create-scenario", function() {
it("should create a patched scenario", async function() {
slowTest(this);
requiresFactorio(this);
const output = path.join("temp", "test", "patched-scenario");
await fs.rm(output, { recursive: true, force: true });
await execHost("create-scenario patched-scenario --plugins research_sync");
const control = await fs.readFile(path.join(output, "control.lua"), "utf8");
assert(control.includes('require("modules/research_sync/sync")'));
await fs.access(path.join(output, "scenario.lua"));
});
});
describe("hostUpdateEventHandler()", function() {
it("should trigger when a new host is added", async function() {
slowTest(this);