2 Commits

  1. 2
      test/command_nick.js
  2. 28
      test/command_quit.js

2
test/command_nick.js

@ -56,6 +56,8 @@ describe("NICK no NICK given", function () {
done("Destroyed socket without answering")
}
console.log(server.getUserObjectFromNickName("some_nick"))
server.emit("connection", mockedSock)
mockedSock.emit('data', Buffer.from("NICK \r\n", "ascii"))
})

28
test/command_quit.js

@ -0,0 +1,28 @@
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) {
}
server.emit('connection', mockedSock)
mockedSock.emit('data', Buffer.from("NICK nick" + i + "\r\n", "ascii"))
}
mockedSock.quit("gone to have lunch")
mockedSock.destroy = function () {
done("Destroyed socket without answering")
}
})
})
Loading…
Cancel
Save