2 Commits

  1. 4
      src/server.js
  2. 4
      test/command_nick.js

4
src/server.js

@ -57,12 +57,12 @@ server.create = function create(config = {}) {
user.setNickname(nickname) user.setNickname(nickname)
userlist[user.nickname] = user userlist[user.nickname] = user
} else { } else {
socket.write(ERR_NICKNAMEINUSE, " nickname in use")
socket.write(`:irc.example.com ${ERR_NICKNAMEINUSE} ${nickname} :Nickname is already in use`, 'ascii')
} }
} else { } else {
socket.write(ERR_NONICKNAMEGIVEN, "ERROR: NO NICKNAME PROVIDED")
socket.write(`:irc.example.com ${ERR_NONICKNAMEGIVEN} :No nickname given`, 'ascii')
} }
break; break;

4
test/command_nick.js

@ -31,7 +31,7 @@ describe("NICK already registered", function () {
} }
let mockedSock2 = new EventEmitter() let mockedSock2 = new EventEmitter()
mockedSock2.write = function (data) { mockedSock2.write = function (data) {
assert.equal(data.toString("ascii"), "433")
assert.equal(data.toString("ascii"), ":irc.example.com 433 some_nick :Nickname is already in use")
done() done()
} }
mockedSock2.destroy = function () { mockedSock2.destroy = function () {
@ -49,7 +49,7 @@ describe("NICK no NICK given", function () {
const server = IRCServer.create() const server = IRCServer.create()
let mockedSock = new EventEmitter() let mockedSock = new EventEmitter()
mockedSock.write = function (data) { mockedSock.write = function (data) {
assert.equal(data.toString("ascii"), "431")
assert.equal(data.toString("ascii"), ":irc.example.com 431 :No nickname given")
done() done()
} }
mockedSock.destroy = function () { mockedSock.destroy = function () {

Loading…
Cancel
Save