|
@ -16,8 +16,8 @@ describe('User', function () { |
|
|
}) |
|
|
}) |
|
|
}) |
|
|
}) |
|
|
|
|
|
|
|
|
describe('#sendMsg(from, message)', function() { |
|
|
|
|
|
it("should send a message to the user's socket", function (done) { |
|
|
|
|
|
|
|
|
describe('#sendMsg(from, message, to)', function() { |
|
|
|
|
|
it("should send a message to the user's socket with the user himself as target", function (done) { |
|
|
let mockedSock = {write: function (data) { |
|
|
let mockedSock = {write: function (data) { |
|
|
assert.equal(data, ":some_nick PRIVMSG some_nick :test message\r\n") |
|
|
assert.equal(data, ":some_nick PRIVMSG some_nick :test message\r\n") |
|
|
done() |
|
|
done() |
|
@ -27,6 +27,17 @@ describe('User', function () { |
|
|
user.register("some_nick") |
|
|
user.register("some_nick") |
|
|
user.sendMsg(user, "test message") |
|
|
user.sendMsg(user, "test message") |
|
|
}) |
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
it("should send a message to the user's socket with a different target", function (done) { |
|
|
|
|
|
let mockedSock = {write: function (data) { |
|
|
|
|
|
assert.equal(data, ":some_nick PRIVMSG #testchan :test message\r\n") |
|
|
|
|
|
done() |
|
|
|
|
|
}} |
|
|
|
|
|
const user = new User(mockedSock, true) |
|
|
|
|
|
user.setNickname("some_nick") |
|
|
|
|
|
user.register("some_nick") |
|
|
|
|
|
user.sendMsg(user, "test message", "#testchan") |
|
|
|
|
|
}) |
|
|
}) |
|
|
}) |
|
|
|
|
|
|
|
|
describe('#sendRaw(message)', function() { |
|
|
describe('#sendRaw(message)', function() { |
|
|