girc
Version:
IRC Client library
25 lines (22 loc) • 1.07 kB
JavaScript
/*jslint node: true, vars: true*/
/*global describe, it*/
;
describe('plugins/motd.js', function () {
var stream = new (require('stream').PassThrough)();
var cmngr = new (require('../../lib/connectionManager'))({id: "test_plugin_motd", nick: "testnick"}, stream);
var con = cmngr.getConnection('test_plugin_motd');
stream.emit('connect');
describe('on RPL_MOTDSTART', function () {
it('should emit "motd"', function (done) {
con.once('motd', function (motd) {
motd[0].should.equal('example.irc.net message of the day');
motd[1].should.equal('- THE CAKE IS A LIE');
motd[2].should.equal('End of message of the day.');
done();
});
stream.write(':example.irc.net 375 foo :example.irc.net message of the day\r\n');
stream.write(':example.irc.net 372 foo :- THE CAKE IS A LIE\r\n');
stream.write(':example.irc.net 376 foo :End of message of the day.\r\n');
});
});
});