From 3aefcb062f6624fbe3bb5ee0a390c5c8d5a7690d Mon Sep 17 00:00:00 2001 From: bbassie <17990055+bbassie@users.noreply.github.com> Date: Thu, 19 Nov 2026 16:26:37 +0000 Subject: [PATCH] Unit test mod-pack show warnings and export assets Co-Authored-By: Claude Opus 5.5 --- test/ctl/commands.test.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/test/ctl/commands.test.js b/test/ctl/commands.test.js index 05b5fd0e..86bdf56b 100644 --- a/test/ctl/commands.test.js +++ b/test/ctl/commands.test.js @@ -1,6 +1,7 @@ import assert from "node:assert/strict"; import * as lib from "@clusterio/lib"; import { modCommands } from "@clusterio/ctl/dist/node/src/commands_mod.js"; +import { modPackCommands } from "@clusterio/ctl/dist/node/src/commands_mod_pack.js"; import { userCommands } from "@clusterio/ctl/dist/node/src/commands_user.js"; import { CommandOutput } from "@clusterio/ctl/dist/node/src/command_ops.js"; @@ -24,6 +25,9 @@ function mockCtl(responses) { async send(message) { return responses.get(message.constructor)(message); }, + async sendTo(destination, message) { + return this.send(message); + }, }; } @@ -45,6 +49,24 @@ describe("ctl/commands", function() { }); }); + describe("mod-pack show", function() { + it("marks missing mods and checksum mismatches and lists export assets", async function() { + const modPack = lib.ModPack.fromJSON({ id: 7, name: "pack" }); + modPack.mods.set("gone", { name: "gone", enabled: true, version: "1.0.0" }); + modPack.mods.set("changed", { name: "changed", enabled: false, version: "1.0.0", sha1: "aaa" }); + modPack.exportManifest = { assets: { settings: "settings.json" } }; + const ctl = mockCtl(new Map([ + [lib.ModListRequest, () => [{ id: "changed_1.0.0", sha1: "bbb" }]], + [lib.ModPackListRequest, () => [modPack]], + [lib.ModPackGetRequest, () => modPack], + ])); + const lines = await captureLog(() => modPackCommands.get("show").run({ modPack: "pack" }, ctl)); + assert(lines.includes(" ? gone 1.0.0"), lines.join("\n")); + assert(lines.includes(" ! (disabled) changed 1.0.0 (aaa)"), lines.join("\n")); + assert(lines.includes(" settings: settings.json"), lines.join("\n")); + }); + }); + describe("user show", function() { const show = userCommands.get("show"); it("prints stats per instance", async function() {