Example #1
0
 this.join(c1, function(err, ch) {
   err.should.be.an.instanceof(Error);
   err.message.should.equal("Forwarding to another channel");
   ch.name.should.equal(c2.name);
   bot.channels.has(c2.id).should.equal(true);
   bot.channels.has(irc.id("#fwdfrom")).should.equal(false);
   done();
 });
Example #2
0
 setTimeout(function() {
   bot.channels.has(irc.id("#kickedfrom")).should.equal(true);
   server.recite(f(":kicky@kick.com KICK #lol,%s @other,%s,+another\r\n", chan.name, bot.user.nick));
   setTimeout(function() {
     bot.channels.has(irc.id("#kickedfrom")).should.equal(false);
     done();
   }, 10);
 }, 10);
Example #3
0
 setTimeout(function() {
   should.not.exist(bot.channels.get(irc.id("#removepeople"))
     .people.get(irc.id("protobot1")));
   should.not.exist(bot.channels.get(irc.id("#removepeople"))
     .people.get(irc.id("protobot2")));
   should.not.exist(bot.channels.get(irc.id("#removepeople"))
     .people.get(irc.id("protobot3")));
   should.not.exist(bot.channels.get(irc.id("#quitters"))
     .people.get(irc.id("protobot3")));
   done();
 }, 10);
Example #4
0
 setTimeout(function() {
   should.exist(chan.people.get(irc.id("protobot")));
   chan.people.get(irc.id("protobot")).should.be.an.instanceof(irc.Person);
   should.exist(chan.people.get(irc.id("some")));
   should.exist(chan.people.get(irc.id("different")));
   should.exist(chan.people.get(irc.id("nicks")));
   chan.people.get(irc.id("some")).should.be.an.instanceof(irc.Person);
   chan.people.get(irc.id("different")).should.be.an.instanceof(irc.Person);
   chan.people.get(irc.id("nicks")).should.be.an.instanceof(irc.Person);
   done();
 }, 10);
Example #5
0
 bot.join(chan, function(ch) {
   bot.channels.has(irc.id(chan)).should.equal(true);
   server.on("message", function ok(m) {
     if (!/PART/.test(m)) {
       return;
     }
     server.removeListener("message", ok);
     m.should.equal(f("PART %s\r\n", chan));
     server.recite(f(":%s!~a@b.c PART %s\r\n", bot.user.nick, chan));
     done();
   });
   bot.part(chan);
 });
test('fake id', t => {
  const rnd = randomizer(0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9)
  t.is(fake.id(rnd), 'agmsyFLR', 'is a predictable code')
  t.is(fake.id(rnd), 'X3agmsyF', 'is a predictable code')
  t.is(fake.id(rnd), 'LRX3agms', 'is a predictable code')
  t.is(fake.id(rnd), 'yFLRX3ag', 'is a predictable code')
  t.is(fake.id(rnd), 'msyFLRX3', 'is a predictable code')
  t.is(fake.id(rnd), 'agmsyFLR', 'is a predictable code')
  t.is(fake.id(rnd), 'X3agmsyF', 'is a predictable code')
  t.is(fake.id(rnd), 'LRX3agms', 'is a predictable code')
  t.is(fake.id(rnd), 'yFLRX3ag', 'is a predictable code')
  t.is(fake.id(rnd), 'msyFLRX3', 'is a predictable code')
  t.is(fake.id(Math, 1, 1).length, 1, 'can be a fixed length')
  t.is(fake.id(Math, 10, 10).length, 10, 'can be a fixed length')
  t.is(fake.id(Math, 100, 100).length, 100, 'can be a fixed length')
  t.is(fake.id(Math, 1, 100).length, 8, 'wants to be 8 chars long')
  t.truthy(fake.id(Math, 9, 100).length < 17, 'tries to be short')
  t.truthy(fake.id(Math, 9, 100).length < 17, 'tries to be short')
  t.truthy(fake.id(Math, 9, 100).length < 17, 'tries to be short')
  t.truthy(fake.id(Math, 9, 100).length < 17, 'tries to be short')
  t.truthy(fake.id(Math, 9, 100).length < 17, 'tries to be short')
  t.truthy(fake.id(Math, 9, 100).length < 17, 'tries to be short')
})
Example #7
0
 chan.join(function(ch) {
   chan.should.equal(ch);
   ch.people.has(bot.user.id).should.equal(true);
   ch.people.has(irc.id("nlogax")).should.equal(true);
   done();
 });
Example #8
0
 var ch = bot.join("#channeltwo", function() {
   ch.people.get(irc.id(nick)).should.equal(
     bot.channels.get(irc.id("#channelone")).people.get(irc.id(nick)));
   done();
 });
Example #9
0
 setTimeout(function() {
   bot.channels.has(irc.id("#kickedfrom")).should.equal(false);
   done();
 }, 10);
Example #10
0
 this.join(chan, function(ch) {
   bot.channels.has(irc.id("#addchanobj")).should.equal(true);
   bot.channels.get(irc.id("#addchanobj")).should.equal(chan);
   bot.channels.get(chan.id).should.equal(chan);
   done();
 });