Browse Source

Fix nickname error responses to match RFC

fix/wrongParams
Sheogorath 6 years ago
parent
commit
46efd78734
No known key found for this signature in database GPG Key ID: 1F05CC3635CDDFFD
  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)
userlist[user.nickname] = user
} else {
socket.write(ERR_NICKNAMEINUSE, " nickname in use")
socket.write(`:irc.example.com ${ERR_NICKNAMEINUSE} ${nickname} :Nickname is already in use`, 'ascii')
}
} else {
socket.write(ERR_NONICKNAMEGIVEN, "ERROR: NO NICKNAME PROVIDED")
socket.write(`:irc.example.com ${ERR_NONICKNAMEGIVEN} :No nickname given`, 'ascii')
}
break;

4
test/command_nick.js

@ -31,7 +31,7 @@ describe("NICK already registered", function () {
}
let mockedSock2 = new EventEmitter()
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()
}
mockedSock2.destroy = function () {
@ -49,7 +49,7 @@ describe("NICK no NICK given", function () {
const server = IRCServer.create()
let mockedSock = new EventEmitter()
mockedSock.write = function (data) {
assert.equal(data.toString("ascii"), "431")
assert.equal(data.toString("ascii"), ":irc.example.com 431 :No nickname given")
done()
}
mockedSock.destroy = function () {

Loading…
Cancel
Save