UNPKG

girc

Version:
83 lines (77 loc) 3.37 kB
/*jslint node: true, vars: true*/ /*global describe, it*/ "use strict"; describe('plugins/names.js', function () { var stream = new (require('stream').PassThrough)(); var cmngr = new (require('../../lib/connectionManager'))({id: "test_plugin_names", nick: "testnick"}, stream); var con = cmngr.getConnection('test_plugin_names'); stream.emit('connect'); describe('client.names(chan, fn)', function () { it('should respond with user names', function (done) { con.names('#channel2', function (names) { names.should.eql({ "Ditti": [], "pot": [], "maggin": [], "Joshua": [], "coleytab": [], "SteveJobs": [], "SSL": [], "dan": [], "Krystal": [], "Ares": [], "hdrv": [], "Stats": [], "pupskuchen": ['~', '@'], "TokeBot": [], "Coley": ['@'], "cock": [], "FapBot": [], "benvei": [], "GLaDOS": [], "KeratBot": [] }); done(); }); setImmediate(function () { stream.write(':example.irc.net 353 testnick @ #channel2 :Ditti pot maggin Joshua coleytab SteveJobs SSL dan Krystal Ares hdrv Stats ~@pupskuchen\r\n'); stream.write(':example.irc.net 353 testnick @ #channel2 :TokeBot @Coley cock FapBot benvei GLaDOS KeratBot\r\n'); stream.write(':example.irc.net 366 testnick #channel2 :End of /NAMES list.\r\n'); }); }); }); describe('on RPL_ENDOFNAMES', function () { it('should emit "names"', function (done) { con.once('names', function (event) { event.channel.getName().should.equal('#channel'); event.names.should.eql({ "Ditti": [], "pot": [], "maggin": [], "Joshua": [], "coleytab": [], "SteveJobs": [], "SSL": [], "dan": [], "Krystal": [], "Ares": [], "hdrv": [], "Stats": [], "pupskuchen": ['~', '@'], "TokeBot": [], "Coley": ['@'], "cock": [], "FapBot": [], "benvei": [], "GLaDOS": [], "KeratBot": [] }); done(); }); stream.write(':testnick!testuser@testhost.com JOIN :#channel\r\n'); stream.write(':example.irc.net 353 testnick = #channel :Ditti pot maggin Joshua coleytab SteveJobs SSL dan Krystal Ares hdrv Stats ~@pupskuchen\r\n'); stream.write(':example.irc.net 353 testnick = #channel :TokeBot @Coley cock FapBot benvei GLaDOS KeratBot\r\n'); stream.write(':example.irc.net 366 testnick #channel :End of /NAMES list.\r\n'); }); }); });