Revision control

Copy as Markdown

Other Tools

/* Any copyright is dedicated to the Public Domain.
var { GenericIRCConversation, ircAccount } = ChromeUtils.importESModule(
);
var messages = {
// Exactly 51 characters.
"This is a test.": ["This is a test."],
// Too long.
"This is a message that is too long.": [
"This is a",
"message that is",
"too long.",
],
// Too short.
"Short msg.": ["Short msg."],
"Thismessagecan'tbecut.": ["Thismessagecan'", "tbecut."],
};
function run_test() {
for (const message in messages) {
const msg = { message };
const generatedMsgs = GenericIRCConversation.prepareForSending.call(
{
__proto__: GenericIRCConversation,
name: "target",
_account: {
__proto__: ircAccount.prototype,
_nickname: "sender",
prefix: "!user@host",
maxMessageLength: 51, // For convenience.
},
},
msg
);
// The expected messages as defined above.
const expectedMsgs = messages[message];
// Ensure the arrays are equal.
deepEqual(generatedMsgs, expectedMsgs);
}
}