diff options
Diffstat (limited to 'js/blotbotboot/node_modules/irc/test')
11 files changed, 0 insertions, 681 deletions
diff --git a/js/blotbotboot/node_modules/irc/test/data/fixtures.json b/js/blotbotboot/node_modules/irc/test/data/fixtures.json deleted file mode 100644 index 5e092a0..0000000 --- a/js/blotbotboot/node_modules/irc/test/data/fixtures.json +++ /dev/null @@ -1,197 +0,0 @@ -{ - "basic": { - "sent": [ - ["NICK testbot", "Client sent NICK message"], - ["USER nodebot 8 * :nodeJS IRC client", "Client sent USER message"], - ["QUIT :node-irc says goodbye", "Client sent QUIT message"] - ], - - "received": [ - [":localhost 001 testbot :Welcome to the Internet Relay Chat Network testbot\r\n", "Received welcome message"] - ] - }, - "double-CRLF": { - "sent": [ - ["NICK testbot", "Client sent NICK message"], - ["USER nodebot 8 * :nodeJS IRC client", "Client sent USER message"], - ["QUIT :node-irc says goodbye", "Client sent QUIT message"] - ], - - "received": [ - [":localhost 001 testbot :Welcome to the Internet Relay Chat Network testbot\r\n\r\n", "Received welcome message"] - ] - }, - "parse-line": { - ":irc.dollyfish.net.nz 372 nodebot :The message of the day was last changed: 2012-6-16 23:57": { - "prefix": "irc.dollyfish.net.nz", - "server": "irc.dollyfish.net.nz", - "command": "rpl_motd", - "rawCommand": "372", - "commandType": "reply", - "args": ["nodebot", "The message of the day was last changed: 2012-6-16 23:57"] - }, - ":Ned!~martyn@irc.dollyfish.net.nz PRIVMSG #test :Hello nodebot!": { - "prefix": "Ned!~martyn@irc.dollyfish.net.nz", - "nick": "Ned", - "user": "~martyn", - "host": "irc.dollyfish.net.nz", - "command": "PRIVMSG", - "rawCommand": "PRIVMSG", - "commandType": "normal", - "args": ["#test", "Hello nodebot!"] - }, - ":Ned!~martyn@irc.dollyfish.net.nz PRIVMSG #test ::-)": { - "prefix": "Ned!~martyn@irc.dollyfish.net.nz", - "nick": "Ned", - "user": "~martyn", - "host": "irc.dollyfish.net.nz", - "command": "PRIVMSG", - "rawCommand": "PRIVMSG", - "commandType": "normal", - "args": ["#test", ":-)"] - }, - ":Ned!~martyn@irc.dollyfish.net.nz PRIVMSG #test ::": { - "prefix": "Ned!~martyn@irc.dollyfish.net.nz", - "nick": "Ned", - "user": "~martyn", - "host": "irc.dollyfish.net.nz", - "command": "PRIVMSG", - "rawCommand": "PRIVMSG", - "commandType": "normal", - "args": ["#test", ":"] - }, - ":Ned!~martyn@irc.dollyfish.net.nz PRIVMSG #test ::^:^:": { - "prefix": "Ned!~martyn@irc.dollyfish.net.nz", - "nick": "Ned", - "user": "~martyn", - "host": "irc.dollyfish.net.nz", - "command": "PRIVMSG", - "rawCommand": "PRIVMSG", - "commandType": "normal", - "args": ["#test", ":^:^:"] - }, - ":some.irc.net 324 webuser #channel +Cnj 5:10": { - "prefix": "some.irc.net", - "server": "some.irc.net", - "command": "rpl_channelmodeis", - "rawCommand": "324", - "commandType": "reply", - "args": ["webuser", "#channel", "+Cnj", "5:10"] - }, - ":nick!user@host QUIT :Ping timeout: 252 seconds": { - "prefix": "nick!user@host", - "nick": "nick", - "user": "user", - "host": "host", - "command": "QUIT", - "rawCommand": "QUIT", - "commandType": "normal", - "args": ["Ping timeout: 252 seconds"] - }, - ":nick!user@host PRIVMSG #channel :so : colons: :are :: not a problem ::::": { - "prefix": "nick!user@host", - "nick": "nick", - "user": "user", - "host": "host", - "command": "PRIVMSG", - "rawCommand": "PRIVMSG", - "commandType": "normal", - "args": ["#channel", "so : colons: :are :: not a problem ::::"] - }, - ":nick!user@host PRIVMSG #channel :\u000314,01\u001fneither are colors or styles\u001f\u0003": { - "prefix": "nick!user@host", - "nick": "nick", - "user": "user", - "host": "host", - "command": "PRIVMSG", - "rawCommand": "PRIVMSG", - "commandType": "normal", - "args": ["#channel", "neither are colors or styles"], - "stripColors": true - }, - ":nick!user@host PRIVMSG #channel :\u000314,01\u001fwe can leave styles and colors alone if desired\u001f\u0003": { - "prefix": "nick!user@host", - "nick": "nick", - "user": "user", - "host": "host", - "command": "PRIVMSG", - "rawCommand": "PRIVMSG", - "commandType": "normal", - "args": ["#channel", "\u000314,01\u001fwe can leave styles and colors alone if desired\u001f\u0003"], - "stripColors": false - }, - ":pratchett.freenode.net 324 nodebot #ubuntu +CLcntjf 5:10 #ubuntu-unregged": { - "prefix": "pratchett.freenode.net", - "server": "pratchett.freenode.net", - "command": "rpl_channelmodeis", - "rawCommand": "324", - "commandType": "reply", - "args": ["nodebot", "#ubuntu", "+CLcntjf", "5:10", "#ubuntu-unregged"] - } - - }, - "433-before-001": { - "sent": [ - ["NICK testbot", "Client sent NICK message"], - ["USER nodebot 8 * :nodeJS IRC client", "Client sent USER message"], - ["NICK testbot1", "Client sent proper response to 433 nickname in use message"], - ["QUIT :node-irc says goodbye", "Client sent QUIT message"] - ], - - "received": [ - [":localhost 433 * testbot :Nickname is already in use.\r\n", "Received nick in use error"], - [":localhost 001 testbot1 :Welcome to the Internet Relay Chat Network testbot\r\n", "Received welcome message"] - ], - "clientInfo": [ - "hostmask is as expected after 433", - "nick is as expected after 433", - "maxLineLength is as expected after 433" - ] - }, - "convert-encoding": { - "causesException": [ - ":ubottu!ubottu@ubuntu/bot/ubottu MODE #ubuntu -bo *!~Brian@* ubottu\r\n", - "Elizabeth", - ":sblack1!~sblack1@unaffiliated/sblack1 NICK :sblack\r\n", - ":TijG!~TijG@null.1ago.be PRIVMSG #ubuntu :ThinkPad\r\n" - ] - }, - "_splitLongLines": [ - { - "input": "abcde ", - "maxLength": 5, - "result": ["abcde"] - }, - { - "input": "abcde", - "maxLength": 5, - "result": ["abcde"] - }, - { - "input": "abcdefghijklmnopqrstuvwxyz", - "maxLength": 5, - "result": ["abcde", "fghij", "klmno", "pqrst", "uvwxy", "z"] - }, - { - "input": "abc abcdef abc abcd abc", - "maxLength": 5, - "result": ["abc", "abcde", "f abc", "abcd", "abc"] - } - ], - "_splitLongLines_no_max": [ - { - "input": "abcdefghijklmnopqrstuvwxyz", - "result": ["abcdefghijklmnopqrstuvwxyz"] - } - ], - "_speak": [ - { - "length": 30, - "expected": 10 - }, - { - "length": 7, - "expected": 1 - } - ] -} diff --git a/js/blotbotboot/node_modules/irc/test/data/ircd.key b/js/blotbotboot/node_modules/irc/test/data/ircd.key deleted file mode 100644 index fc8978a..0000000 --- a/js/blotbotboot/node_modules/irc/test/data/ircd.key +++ /dev/null @@ -1,15 +0,0 @@ ------BEGIN RSA PRIVATE KEY----- -MIICWwIBAAKBgQDH5pYbcECKUrbRbUXKUu7lMCgb9UkPi4+Ur9f0LYdspHZJlv0S -yBn4RpJOl8EsMhWI+houY3mBlcCL/DwiGfMDk5TSomyrI6eONFworokTJpG2h0f0 -cWnGdDW1zu8Z1odo047NWzwwv2mU03fkZmzfCclAzjKkDMMqP34mPl5TnwIDAQAB -AoGAJslK3tAM9cnOxxvYqsUkrTuGzMXvAyElHshvsmUTHbVbbjPprrc8sruer7kq -NhURsJ42bkHG1ankzkSGtmcqi3LdBBhVLm5gyog2JxQlTxvUVOPvyrOsQkl3uDwL -aZqGTESHlLx7jhOKgiImqo0uGxNy46tzsHbpFGAeqTYcYKECQQD6faxqytMpMc/h -zcrWsRhe7Omj5D6VdrbkGkM8razn4Oyr42p8Xylcde2MlnTiTAL5ElxlLd4PYsLD -hKme/M5tAkEAzEwT1GU7CYjPdHHfsHUbDIHBh0BOJje2TXhDOa5tiZbOZevIk6TZ -V6p/9zjLe5RAc/dpzHv1C+vQOkhgvoNyuwJARwjGkU5NTXxTwGwUnoeAKsMyioia -etY8jTkpYha6VtOBKkmGlBiEaTUEFX9BTD9UBIABdavpMiHGq51+YJi+jQJAGYic -pdwtH8jwnM4qtgQ86DhDduMLoW0vJMmWJVxuplap30Uz4XgmDfXqXnzDueNSluvi -VkNb4iyL7uzi4ozNRwJALT0vP65RQ2d7OUEwB4XZFExKYzHADiFtw0NZtcWRW6y3 -rN0uXMxEZ6vRQurVjO9GhB76fAo/UooX0MVF0ShFNQ== ------END RSA PRIVATE KEY----- diff --git a/js/blotbotboot/node_modules/irc/test/data/ircd.pem b/js/blotbotboot/node_modules/irc/test/data/ircd.pem deleted file mode 100644 index 3d8d979..0000000 --- a/js/blotbotboot/node_modules/irc/test/data/ircd.pem +++ /dev/null @@ -1,17 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICojCCAgugAwIBAgIJAMid3M25tUeUMA0GCSqGSIb3DQEBBQUAMGoxCzAJBgNV -BAYTAlpaMREwDwYDVQQIDAhJbnRlcm5ldDEPMA0GA1UEBwwGZ2l0aHViMREwDwYD -VQQKDAhub2RlLWlyYzEQMA4GA1UECwwHdGVzdGluZzESMBAGA1UEAwwJbG9jYWxo -b3N0MB4XDTE1MDExMjIzNDg0MloXDTI1MDEwOTIzNDg0MlowajELMAkGA1UEBhMC -WloxETAPBgNVBAgMCEludGVybmV0MQ8wDQYDVQQHDAZnaXRodWIxETAPBgNVBAoM -CG5vZGUtaXJjMRAwDgYDVQQLDAd0ZXN0aW5nMRIwEAYDVQQDDAlsb2NhbGhvc3Qw -gZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAMfmlhtwQIpSttFtRcpS7uUwKBv1 -SQ+Lj5Sv1/Qth2ykdkmW/RLIGfhGkk6XwSwyFYj6Gi5jeYGVwIv8PCIZ8wOTlNKi -bKsjp440XCiuiRMmkbaHR/RxacZ0NbXO7xnWh2jTjs1bPDC/aZTTd+RmbN8JyUDO -MqQMwyo/fiY+XlOfAgMBAAGjUDBOMB0GA1UdDgQWBBTUaumzrTJrl1goRRzOGgEO -VNKFmjAfBgNVHSMEGDAWgBTUaumzrTJrl1goRRzOGgEOVNKFmjAMBgNVHRMEBTAD -AQH/MA0GCSqGSIb3DQEBBQUAA4GBAGKppBE9mjk2zJPSxPcHl3RSpnPs5ZkuBLnK -rxZ2bR9VJhoQEwtiZRxkSXSdooj3eJgzMobYMEhSvFibUeBuIppB7oacys2Bd+O1 -xzILcbgEPqsk5JFbYT9KD8r+sZy5Wa1A39eNkmdD/oWt9Mb1PLrDfM/melvZ9/vW -oMSmMipK ------END CERTIFICATE----- diff --git a/js/blotbotboot/node_modules/irc/test/helpers.js b/js/blotbotboot/node_modules/irc/test/helpers.js deleted file mode 100644 index 6051da6..0000000 --- a/js/blotbotboot/node_modules/irc/test/helpers.js +++ /dev/null @@ -1,69 +0,0 @@ -/* Mock irc server */ - -var path = require('path'); -var fs = require('fs'); -var net = require('net'); -var tls = require('tls'); -var util = require('util'); -var EventEmitter = require('events').EventEmitter; - -var MockIrcd = function(port, encoding, isSecure) { - var self = this; - var connectionClass; - var options = {}; - - if (isSecure) { - connectionClass = tls; - options = { - key: fs.readFileSync(path.resolve(__dirname, 'data/ircd.key')), - cert: fs.readFileSync(path.resolve(__dirname, 'data/ircd.pem')) - }; - } else { - connectionClass = net; - } - - this.port = port || (isSecure ? 6697 : 6667); - this.encoding = encoding || 'utf-8'; - this.incoming = []; - this.outgoing = []; - - this.server = connectionClass.createServer(options, function(c) { - c.on('data', function(data) { - var msg = data.toString(self.encoding).split('\r\n').filter(function(m) { return m; }); - self.incoming = self.incoming.concat(msg); - }); - - self.on('send', function(data) { - self.outgoing.push(data); - c.write(data); - }); - - c.on('end', function() { - self.emit('end'); - }); - }); - - this.server.listen(this.port); -}; -util.inherits(MockIrcd, EventEmitter); - -MockIrcd.prototype.send = function(data) { - this.emit('send', data); -}; - -MockIrcd.prototype.close = function() { - this.server.close(); -}; - -MockIrcd.prototype.getIncomingMsgs = function() { - return this.incoming; -}; - -var fixtures = require('./data/fixtures'); -module.exports.getFixtures = function(testSuite) { - return fixtures[testSuite]; -}; - -module.exports.MockIrcd = function(port, encoding, isSecure) { - return new MockIrcd(port, encoding, isSecure); -}; diff --git a/js/blotbotboot/node_modules/irc/test/test-433-before-001.js b/js/blotbotboot/node_modules/irc/test/test-433-before-001.js deleted file mode 100644 index ddef05d..0000000 --- a/js/blotbotboot/node_modules/irc/test/test-433-before-001.js +++ /dev/null @@ -1,39 +0,0 @@ -var irc = require('../lib/irc'); -var test = require('tape'); - -var testHelpers = require('./helpers'); - -test('connect and sets hostmask when nick in use', function(t) { - var client, mock, expected; - - mock = testHelpers.MockIrcd(); - client = new irc.Client('localhost', 'testbot', {debug: true}); - - expected = testHelpers.getFixtures('433-before-001'); - - t.plan(expected.sent.length + expected.received.length + expected.clientInfo.length); - - mock.server.on('connection', function() { - mock.send(':localhost 433 * testbot :Nickname is already in use.\r\n') - mock.send(':localhost 001 testbot1 :Welcome to the Internet Relay Chat Network testbot\r\n'); - }); - - client.on('registered', function() { - t.equal(mock.outgoing[0], expected.received[0][0], expected.received[0][1]); - t.equal(mock.outgoing[1], expected.received[1][0], expected.received[1][1]); - client.disconnect(function() { - t.equal(client.hostMask, 'testbot', 'hostmask is as expected after 433'); - t.equal(client.nick, 'testbot1', 'nick is as expected after 433'); - t.equal(client.maxLineLength, 482, 'maxLineLength is as expected after 433'); - }); - }); - - mock.on('end', function() { - var msgs = mock.getIncomingMsgs(); - - for (var i = 0; i < msgs.length; i++) { - t.equal(msgs[i], expected.sent[i][0], expected.sent[i][1]); - } - mock.close(); - }); -}); diff --git a/js/blotbotboot/node_modules/irc/test/test-auditorium.js b/js/blotbotboot/node_modules/irc/test/test-auditorium.js deleted file mode 100644 index 6e00b0a..0000000 --- a/js/blotbotboot/node_modules/irc/test/test-auditorium.js +++ /dev/null @@ -1,36 +0,0 @@ -var net = require('net'); - -var irc = require('../lib/irc'); -var test = require('tape'); - -var testHelpers = require('./helpers'); - -test('user gets opped in auditorium', function(t) { - var mock = testHelpers.MockIrcd(); - var client = new irc.Client('localhost', 'testbot', {debug: true}); - - client.on('+mode', function(channel, by, mode, argument) { - if (channel == '#auditorium' && argument == 'user') { - client.disconnect(); - } - }); - - mock.server.on('connection', function() { - // Initiate connection - mock.send(':localhost 001 testbot :Welcome to the Internet Relay Chat Network testbot\r\n'); - - // Set prefix modes - mock.send(':localhost 005 testbot PREFIX=(ov)@+ CHANTYPES=#& :are supported by this server\r\n'); - - // Force join into auditorium - mock.send(':testbot JOIN #auditorium\r\n'); - - // +o the invisible user - mock.send(':ChanServ MODE #auditorium +o user\r\n'); - }); - - mock.on('end', function() { - mock.close(); - t.end(); - }); -}); diff --git a/js/blotbotboot/node_modules/irc/test/test-convert-encoding.js b/js/blotbotboot/node_modules/irc/test/test-convert-encoding.js deleted file mode 100644 index bbd62fa..0000000 --- a/js/blotbotboot/node_modules/irc/test/test-convert-encoding.js +++ /dev/null @@ -1,53 +0,0 @@ -var irc = require('../lib/irc'); -var test = require('tape'); -var testHelpers = require('./helpers'); -var checks = testHelpers.getFixtures('convert-encoding'); -var bindTo = { opt: { encoding: 'utf-8' } }; - -test('irc.Client.convertEncoding old', function(assert) { - var convertEncoding = function(str) { - var self = this; - - if (self.opt.encoding) { - var charsetDetector = require('node-icu-charset-detector'); - var Iconv = require('iconv').Iconv; - var charset = charsetDetector.detectCharset(str).toString(); - var to = new Iconv(charset, self.opt.encoding); - - return to.convert(str); - } else { - return str; - } - }.bind(bindTo); - - checks.causesException.forEach(function iterate(line) { - var causedException = false; - try { - convertEncoding(line); - } catch (e) { - causedException = true; - } - - assert.equal(causedException, true, line + ' caused exception'); - }); - - assert.end(); -}); - -test('irc.Client.convertEncoding', function(assert) { - var convertEncoding = irc.Client.prototype.convertEncoding.bind(bindTo); - - checks.causesException.forEach(function iterate(line) { - var causedException = false; - - try { - convertEncoding(line); - } catch (e) { - causedException = true; - } - - assert.equal(causedException, false, line + ' didn\'t cause exception'); - }); - - assert.end(); -}); diff --git a/js/blotbotboot/node_modules/irc/test/test-double-crlf.js b/js/blotbotboot/node_modules/irc/test/test-double-crlf.js deleted file mode 100644 index 68982c9..0000000 --- a/js/blotbotboot/node_modules/irc/test/test-double-crlf.js +++ /dev/null @@ -1,33 +0,0 @@ -var net = require('net'); - -var irc = require('../lib/irc'); -var test = require('tape'); - -var testHelpers = require('./helpers'); - -test('sent messages ending with double CRLF', function(t) { - var mock = testHelpers.MockIrcd(); - var client = new irc.Client('localhost', 'testbot', { debug: true}); - - var expected = testHelpers.getFixtures('double-CRLF'); - - t.plan(expected.sent.length + expected.received.length); - - mock.server.on('connection', function() { - mock.send(expected.received[0][0]); - }); - - client.on('registered', function() { - t.equal(mock.outgoing[0], expected.received[0][0], expected.received[0][1]); - client.disconnect(); - }); - - mock.on('end', function() { - var msgs = mock.getIncomingMsgs(); - - for (var i = 0; i < msgs.length; i++) { - t.equal(msgs[i], expected.sent[i][0], expected.sent[i][1]); - } - mock.close(); - }); -}); diff --git a/js/blotbotboot/node_modules/irc/test/test-irc.js b/js/blotbotboot/node_modules/irc/test/test-irc.js deleted file mode 100644 index 65be4b5..0000000 --- a/js/blotbotboot/node_modules/irc/test/test-irc.js +++ /dev/null @@ -1,132 +0,0 @@ -var net = require('net'); - -var irc = require('../lib/irc'); -var test = require('tape'); - -var testHelpers = require('./helpers'); - -var expected = testHelpers.getFixtures('basic'); -var greeting = ':localhost 001 testbot :Welcome to the Internet Relay Chat Network testbot\r\n'; - -test('connect, register and quit', function(t) { - runTests(t, false, false); -}); - -test('connect, register and quit, securely', function(t) { - runTests(t, true, false); -}); - -test('connect, register and quit, securely, with secure object', function(t) { - runTests(t, true, true); -}); - -function runTests(t, isSecure, useSecureObject) { - var port = isSecure ? 6697 : 6667; - var mock = testHelpers.MockIrcd(port, 'utf-8', isSecure); - var client; - if (isSecure && useSecureObject) { - client = new irc.Client('notlocalhost', 'testbot', { - secure: { - host: 'localhost', - port: port, - rejectUnauthorized: false - }, - selfSigned: true, - retryCount: 0, - debug: true - }); - } else { - var client = new irc.Client('localhost', 'testbot', { - secure: isSecure, - selfSigned: true, - port: port, - retryCount: 0, - debug: true - }); - } - - t.plan(expected.sent.length + expected.received.length); - - mock.server.on(isSecure ? 'secureConnection' : 'connection', function() { - mock.send(greeting); - }); - - client.on('registered', function() { - t.equal(mock.outgoing[0], expected.received[0][0], expected.received[0][1]); - client.disconnect(); - }); - - mock.on('end', function() { - var msgs = mock.getIncomingMsgs(); - - for (var i = 0; i < msgs.length; i++) { - t.equal(msgs[i], expected.sent[i][0], expected.sent[i][1]); - } - mock.close(); - }); -} - -test ('splitting of long lines', function(t) { - var port = 6667; - var mock = testHelpers.MockIrcd(port, 'utf-8', false); - var client = new irc.Client('localhost', 'testbot', { - secure: false, - selfSigned: true, - port: port, - retryCount: 0, - debug: true - }); - - var group = testHelpers.getFixtures('_splitLongLines'); - t.plan(group.length); - group.forEach(function(item) { - t.deepEqual(client._splitLongLines(item.input, item.maxLength, []), item.result); - }); - mock.close(); -}); - -test ('splitting of long lines with no maxLength defined.', function(t) { - var port = 6667; - var mock = testHelpers.MockIrcd(port, 'utf-8', false); - var client = new irc.Client('localhost', 'testbot', { - secure: false, - selfSigned: true, - port: port, - retryCount: 0, - debug: true - }); - - var group = testHelpers.getFixtures('_splitLongLines_no_max'); - console.log(group.length); - t.plan(group.length); - group.forEach(function(item) { - t.deepEqual(client._splitLongLines(item.input, null, []), item.result); - }); - mock.close(); -}); - -test ('opt.messageSplit used when set', function(t) { - var port = 6667; - var mock = testHelpers.MockIrcd(port, 'utf-8', false); - var client = new irc.Client('localhost', 'testbot', { - secure: false, - selfSigned: true, - port: port, - retryCount: 0, - debug: true, - messageSplit: 10 - }); - - var group = testHelpers.getFixtures('_speak'); - t.plan(group.length); - group.forEach(function(item) { - client.maxLineLength = item.length; - client._splitLongLines = function(words, maxLength, destination) { - t.equal(maxLength, item.expected); - return [words]; - } - client._speak('kind', 'target', 'test message'); - }); - - mock.close(); -}); diff --git a/js/blotbotboot/node_modules/irc/test/test-mode.js b/js/blotbotboot/node_modules/irc/test/test-mode.js deleted file mode 100644 index 47f9cc5..0000000 --- a/js/blotbotboot/node_modules/irc/test/test-mode.js +++ /dev/null @@ -1,68 +0,0 @@ -var irc = require('../lib/irc'); -var test = require('tape'); - -var testHelpers = require('./helpers'); - -test('various origins and types of chanmodes get handled correctly', function(t) { - var mock = testHelpers.MockIrcd(); - var client = new irc.Client('localhost', 'testbot', { debug: true }); - - var count = 0; - client.on('+mode', function() { - //console.log(client.chans['#channel']); - t.deepEqual(client.chans['#channel'], expected[count++]); - }); - client.on('-mode', function() { - //console.log(client.chans['#channel']); - t.deepEqual(client.chans['#channel'], expected[count++]); - }); - - var expected = [ - { key: '#channel', serverName: '#channel', users: {}, modeParams: { n: [] }, mode: 'n' }, - { key: '#channel', serverName: '#channel', users: {}, modeParams: { n: [], t: [] }, mode: 'nt' }, - { key: '#channel', serverName: '#channel', users: { testbot: '@' }, mode: '+ntb', modeParams: { b: ['*!*@AN.IP.1'], n: [], t: [] } }, - { key: '#channel', serverName: '#channel', users: { testbot: '@' }, mode: '+ntb', modeParams: { b: ['*!*@AN.IP.1', '*!*@AN.IP.2'], n: [], t: [] } }, - { key: '#channel', serverName: '#channel', users: { testbot: '@' }, mode: '+ntb', modeParams: { b: ['*!*@AN.IP.1', '*!*@AN.IP.2', '*!*@AN.IP.3'], n: [], t: [] } }, - { key: '#channel', serverName: '#channel', users: { testbot: '@' }, mode: '+ntb', modeParams: { b: ['*!*@AN.IP.1', '*!*@AN.IP.3'], n: [], t: [] } }, - { key: '#channel', serverName: '#channel', users: { testbot: '@' }, mode: '+ntbf', modeParams: { f: ['[10j]:15'], b: ['*!*@AN.IP.1', '*!*@AN.IP.3'], n: [], t: [] } }, - { key: '#channel', serverName: '#channel', users: { testbot: '@' }, mode: '+ntbf', modeParams: { f: ['[8j]:15'], b: ['*!*@AN.IP.1', '*!*@AN.IP.3'], n: [], t: [] } }, - { key: '#channel', serverName: '#channel', users: { testbot: '@' }, mode: '+ntb', modeParams: { b: ['*!*@AN.IP.1', '*!*@AN.IP.3'], n: [], t: [] } }, - { key: '#channel', serverName: '#channel', users: { testbot: '@' }, mode: '+ntbj', modeParams: { j: ['3:5'], b: ['*!*@AN.IP.1', '*!*@AN.IP.3'], n: [], t: [] } }, - { key: '#channel', serverName: '#channel', users: { testbot: '@' }, mode: '+ntbj', modeParams: { j: ['2:5'], b: ['*!*@AN.IP.1', '*!*@AN.IP.3'], n: [], t: [] } }, - { key: '#channel', serverName: '#channel', users: { testbot: '@' }, mode: '+ntb', modeParams: { b: ['*!*@AN.IP.1', '*!*@AN.IP.3'], n: [], t: [] } }, - { key: '#channel', serverName: '#channel', users: { testbot: '@' }, mode: '+ntbp', modeParams: { p: [], b: ['*!*@AN.IP.1', '*!*@AN.IP.3'], n: [], t: [] } }, - { key: '#channel', serverName: '#channel', users: { testbot: '@' }, mode: '+ntbps', modeParams: { s: [], p: [], b: ['*!*@AN.IP.1', '*!*@AN.IP.3'], n: [], t: [] } }, - { key: '#channel', serverName: '#channel', users: { testbot: '@' }, mode: '+ntbpsK', modeParams: { K: [], s: [], p: [], b: ['*!*@AN.IP.1', '*!*@AN.IP.3'], n: [], t: [] } }, - { key: '#channel', serverName: '#channel', users: { testbot: '@' }, mode: '+ntbsK', modeParams: { K: [], s: [], b: ['*!*@AN.IP.1', '*!*@AN.IP.3'], n: [], t: [] } }, - { key: '#channel', serverName: '#channel', users: { testbot: '@' }, mode: '+ntbK', modeParams: { K: [], b: ['*!*@AN.IP.1', '*!*@AN.IP.3'], n: [], t: [] } }, - { key: '#channel', serverName: '#channel', users: { testbot: '@' }, mode: '+ntbKF', modeParams: { F: [], K: [], b: ['*!*@AN.IP.1', '*!*@AN.IP.3'], n: [], t: [] } } - ]; - - mock.server.on('connection', function() { - mock.send(':localhost 001 testbot :Welcome!\r\n'); - mock.send(':localhost 005 testbot MODES=12 CHANTYPES=# PREFIX=(ohv)@%+ CHANMODES=beIqa,kfL,lj,psmntirRcOAQKVCuzNSMTGHFEB\r\n'); - mock.send(':testbot MODE testbot :+ix\r\n'); - mock.send(':testbot JOIN :#channel\r\n'); - mock.send(':localhost MODE #channel +nt\r\n'); - mock.send(':localhost 353 testbot = #channel :@testbot\r\n'); - mock.send(':localhost 366 testbot #channel :End of /NAMES list.\r\n'); - mock.send(':localhost 324 testbot #channel +nt\r\n'); - mock.send(':localhost MODE #channel +b *!*@AN.IP.1\r\n'); - mock.send(':localhost MODE #channel +bb *!*@AN.IP.2 *!*@AN.IP.3\r\n'); - mock.send(':localhost MODE #channel -b *!*@AN.IP.2\r\n'); - mock.send(':localhost MODE #channel +f [10j]:15\r\n'); - mock.send(':localhost MODE #channel +f [8j]:15\r\n'); - mock.send(':localhost MODE #channel -f+j [10j]:15 3:5\r\n'); - mock.send(':localhost MODE #channel +j 2:5\r\n'); - mock.send(':localhost MODE #channel -j\r\n'); - mock.send(':localhost MODE #channel +ps\r\n'); - mock.send(':localhost MODE #channel +K-p-s+F\r\n'); - - client.disconnect(); - }); - - mock.on('end', function() { - mock.close(); - t.end(); - }); -}); diff --git a/js/blotbotboot/node_modules/irc/test/test-parse-line.js b/js/blotbotboot/node_modules/irc/test/test-parse-line.js deleted file mode 100644 index c0da515..0000000 --- a/js/blotbotboot/node_modules/irc/test/test-parse-line.js +++ /dev/null @@ -1,22 +0,0 @@ -var parseMessage = require('../lib/parse_message'); -var test = require('tape'); - -var testHelpers = require('./helpers'); - -test('irc.parseMessage', function(t) { - var checks = testHelpers.getFixtures('parse-line'); - - Object.keys(checks).forEach(function(line) { - var stripColors = false; - if (checks[line].hasOwnProperty('stripColors')) { - stripColors = checks[line].stripColors; - delete checks[line].stripColors; - } - t.equal( - JSON.stringify(checks[line]), - JSON.stringify(parseMessage(line, stripColors)), - line + ' parses correctly' - ); - }); - t.end(); -}); |