|
|
@ -62,4 +62,23 @@ describe('User', function () { |
|
|
|
user.closeConnection() |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
describe('#setNickname(nickname)', function() { |
|
|
|
it('should not answer on inital setting of nickname', function () { |
|
|
|
let mockedSock = {} |
|
|
|
const user = new User(mockedSock, true) |
|
|
|
user.setNickname("some_nick") |
|
|
|
assert.equal(user.getNickname(), "some_nick") |
|
|
|
}) |
|
|
|
|
|
|
|
it('should answer with NICK message from original nick on rename', function (done) { |
|
|
|
let mockedSock = {write: function (data) { |
|
|
|
assert.equal(data, ":some_nick NICK changed_nick\r\n") |
|
|
|
done() |
|
|
|
}} |
|
|
|
const user = new User(mockedSock, true) |
|
|
|
user.setNickname("some_nick") |
|
|
|
user.setNickname("changed_nick") |
|
|
|
}) |
|
|
|
}) |
|
|
|
}) |