Skip to content
This repository has been archived by the owner on Sep 10, 2024. It is now read-only.

Commit

Permalink
Test notice from server
Browse files Browse the repository at this point in the history
  • Loading branch information
Throne3d committed Sep 28, 2017
1 parent 719186e commit 8f79775
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions test/test-user-events.js
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,35 @@ describe('Client', function() {
}, 10);
}
});

it('handles notice from user correctly', function(done) {
var self = this;

self.client.out.debug = sinon.spy();
self.client.on('notice', finish);
self.mock.send(':127.0.0.1 NOTICE testbot :test message 1\r\n');

function finish(from, to, text, message) {
var msg = {
prefix: '127.0.0.1',
server: '127.0.0.1',
command: 'NOTICE',
rawCommand: 'NOTICE',
commandType: 'normal',
args: ['testbot', 'test message 1']
};
expect(from).to.be.undefined;
expect(to).to.equal('testbot');
expect(text).to.equal('test message 1');
expect(message).to.deep.equal(msg);
setTimeout(function() {
expect(self.client.out.debug.args).to.deep.include(
['GOT NOTICE from the server: "test message 1"']
);
done();
}, 10);
}
});
});

describe('PRIVMSG', function() {
Expand Down

0 comments on commit 8f79775

Please sign in to comment.