You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
838 B

const assert = require('assert');
const EventEmitter = require('events');
const IRCServer = require("../src/server.js");
describe("QUIT OK", function () {
it("should handle a QUIT command -> QUIT quitmessage", function (done) {
const server = IRCServer.create()
for (var i = 0; i < 3; i++) {
let mockedSock = new EventEmitter()
mockedSock.write = function (data) {
done("ERROR: did not expect a message")
}
server.emit('connection', mockedSock)
mockedSock.emit('data', Buffer.from("NICK nick" + i + "\r\n", "ascii"))
mockedSock.destroy = function () {
done()
}
}
server.getUserlist()["nick0"].connection.emit('data', Buffer.from("QUIT :Gone to have lunch\r\n", "ascii"))
})
})