Add test for ISUPPORT-less networks on /mode shorthands

This commit is contained in:
JeDaYoshi 2021-07-04 01:01:45 +00:00
parent e0e12c1960
commit 23f6886cc1
No known key found for this signature in database
GPG key ID: 8060B288C274219D

View file

@ -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");
});
});
});