From aadf24db99046f0e2a32b83063c051d0f2baf740 Mon Sep 17 00:00:00 2001 From: Hornwitser Date: Sat, 16 Jul 2022 14:30:06 +0200 Subject: [PATCH] Add test for sending user ban_reason --- test/integration/clusterio.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/test/integration/clusterio.js b/test/integration/clusterio.js index 375c1eca..8c029e1f 100644 --- a/test/integration/clusterio.js +++ b/test/integration/clusterio.js @@ -480,6 +480,10 @@ describe("Integration of Clusterio", function() { return new Map(result.list.map(user => [user.name, user])); } + async function getUser(name) { + return await libLink.messages.getUser.send(getControl(), { name }); + } + let lists = ["admin", "whitelisted", "banned"]; it("should add and remove the given user to the list", async function() { slowTest(this); @@ -522,6 +526,15 @@ describe("Integration of Clusterio", function() { } assert.equal(getControl().userUpdates.length, 3); }); + it("should send ban reason", async function() { + slowTest(this); + getControl().userUpdates = []; + await execCtl("user set-banned --create test_ban_reason --reason a-reason"); + assert.equal(getControl().userUpdates.length, 1); + assert.equal(getControl().userUpdates[0].ban_reason, "a-reason"); + let user = await getUser("test_ban_reason"); + assert.equal(user["ban_reason"], "a-reason"); + }); }); describe("instance extract-players", function() {