|
@ -37,6 +37,22 @@ describe('IRC server', function() { |
|
|
done("Destroyed socket without answering") |
|
|
done("Destroyed socket without answering") |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
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() |
|
|
|
|
|
let mockedSock = new EventEmitter() |
|
|
|
|
|
mockedSock.write = function (data) { |
|
|
|
|
|
assert.equal(data.toString("ascii"), "433") |
|
|
|
|
|
done() |
|
|
|
|
|
} |
|
|
|
|
|
mockedSock.destroy = function () { |
|
|
|
|
|
done("Destroyed socket without answering") |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
server.emit("connection", mockedSock) |
|
|
server.emit("connection", mockedSock) |
|
|
mockedSock.emit('data', Buffer.from("NICK some_nick\r\n", "ascii")) |
|
|
mockedSock.emit('data', Buffer.from("NICK some_nick\r\n", "ascii")) |
|
|
}) |
|
|
}) |
|
|