|
|
@ -25,6 +25,29 @@ describe("JOIN OK", function () { |
|
|
|
mockedSock.emit('data', Buffer.from("USER guest tolmoon tolsun :Ronnie Reagan\r\n", "ascii")) |
|
|
|
mockedSock.emit('data', Buffer.from("JOIN #testchan\r\n", "ascii")) |
|
|
|
}) |
|
|
|
it("try to join/create channel with invalid channel name (no #)", function (done) { |
|
|
|
const server = IRCServer.create() |
|
|
|
let mockedSock = new EventEmitter() |
|
|
|
mockedSock.address = function () { |
|
|
|
return {port: 12346, family: 'IPv4', address: '127.0.0.1'} |
|
|
|
} |
|
|
|
mockedSock.write = function (data) { |
|
|
|
let answer = data.toString("ascii") |
|
|
|
if (answer.indexOf("404") >= 0) { |
|
|
|
assert.equal(answer, ":irc.example.com 404: invalid channel name") |
|
|
|
done() |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
mockedSock.destroy = function () { |
|
|
|
done("Destroyed socket without answering") |
|
|
|
} |
|
|
|
|
|
|
|
server.emit("connection", mockedSock) |
|
|
|
mockedSock.emit('data', Buffer.from("NICK some_nick\r\n", "ascii")) |
|
|
|
mockedSock.emit('data', Buffer.from("USER guest tolmoon tolsun :Ronnie Reagan\r\n", "ascii")) |
|
|
|
mockedSock.emit('data', Buffer.from("JOIN testchan\r\n", "ascii")) |
|
|
|
}) |
|
|
|
|
|
|
|
it("should handle a JOIN command for more than one user -> JOIN #testchan and send join events to all channel members", function (done) { |
|
|
|
const server = IRCServer.create() |
|
|
|