From 23f6886cc1a3b1932c9f9102a8a94c0fb3b674c3 Mon Sep 17 00:00:00 2001 From: JeDaYoshi Date: Sun, 4 Jul 2021 01:01:45 +0000 Subject: [PATCH] Add test for ISUPPORT-less networks on /mode shorthands --- test/commands/mode.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/test/commands/mode.js b/test/commands/mode.js index c85cafaf..731dcc5e 100644 --- a/test/commands/mode.js +++ b/test/commands/mode.js @@ -33,6 +33,19 @@ describe("Commands", function () { }, }; + const testableNetworkNoSupports = Object.assign({}, testableNetwork, { + irc: { + network: { + supports() { + return null; + }, + }, + raw(...args) { + testableNetworkNoSupports.lastCommand = args.join(" "); + }, + }, + }); + it("should not mess with the given target", function () { const test = function (expected, args) { ModeCommand.input(testableNetwork, channel, "mode", Array.from(args)); @@ -88,7 +101,9 @@ describe("Commands", function () { ModeCommand.input(testableNetwork, channel, "devoice", ["xPaw"]); expect(testableNetwork.lastCommand).to.equal("MODE #thelounge -v xPaw"); + }); + it("should use ISUPPORT MODES on shorthand commands", function () { ModeCommand.input(testableNetwork, channel, "voice", ["xPaw", "Max-P"]); expect(testableNetwork.lastCommand).to.equal("MODE #thelounge +vv xPaw Max-P"); @@ -102,5 +117,13 @@ describe("Commands", function () { ]); expect(testableNetwork.lastCommand).to.equal("MODE #thelounge -v thelounge"); }); + + it("should fallback to default limit of 1 mode for shorthand commands", function () { + ModeCommand.input(testableNetworkNoSupports, channel, "voice", ["xPaw"]); + expect(testableNetworkNoSupports.lastCommand).to.equal("MODE #thelounge +v xPaw"); + + ModeCommand.input(testableNetworkNoSupports, channel, "devoice", ["xPaw", "Max-P"]); + expect(testableNetworkNoSupports.lastCommand).to.equal("MODE #thelounge -v Max-P"); + }); }); });