|
|
@ -40,7 +40,7 @@ describe('IRC server', function () { |
|
|
|
server.emit("connection", mockedSock) |
|
|
|
mockedSock.emit('data', Buffer.from("NICK some_nick\r\n", "ascii")) |
|
|
|
}) |
|
|
|
}), |
|
|
|
}) |
|
|
|
describe("NICK already registered", function () { |
|
|
|
it("should handle a NICK command -> NICK some_nickname", function (done) { |
|
|
|
const server = IRCServer.create() |
|
|
@ -57,4 +57,20 @@ describe('IRC server', function () { |
|
|
|
mockedSock.emit('data', Buffer.from("NICK some_nick\r\n", "ascii")) |
|
|
|
}) |
|
|
|
}) |
|
|
|
describe("NICK no NICK given", function () { |
|
|
|
it("should handle a NICK command -> NICK ", function (done) { |
|
|
|
const server = IRCServer.create() |
|
|
|
let mockedSock = new EventEmitter() |
|
|
|
mockedSock.write = function (data) { |
|
|
|
assert.equal(data.toString("ascii"), "431") |
|
|
|
done() |
|
|
|
} |
|
|
|
mockedSock.destroy = function () { |
|
|
|
done("Destroyed socket without answering") |
|
|
|
} |
|
|
|
|
|
|
|
server.emit("connection", mockedSock) |
|
|
|
mockedSock.emit('data', Buffer.from("NICK \r\n", "ascii")) |
|
|
|
}) |
|
|
|
}) |
|
|
|
}) |