« index
Coverage for /home/spion/Documents/ircee/test/protocol.js : 100%
35 lines |
35 run |
0 missing |
0 partial |
3 blocks |
3 blocks run |
0 blocks missing
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | var protocol = require('../lib/protocol.js'); exports['parse privmsg'] = function(t) { var res = protocol.parse(':nick!user@host PRIVMSG #channel :text goes here') t.deepEqual({ raw: ':nick!user@host PRIVMSG #channel :text goes here', source: 'nick!user@host', cmd: 'PRIVMSG', user: { address: 'nick!user@host', nick: 'nick', user: 'user', host: 'host' }, params: [ '#channel' ], target: '#channel', text: 'text goes here' }, res, 'protocol parse success'); t.done(); } exports['last argument'] = function(t) { var res = protocol.construct(['TOPIC','#channel','topic text']); var hasLast = res.split(':').length > 1; t.ok(hasLast); t.done(); } exports['no last argument'] = function(t) { var res = protocol.construct(['TOPIC','#channel','topic text', null]); var hasLast = res.split(':').length > 1; t.ok(!hasLast); t.done(); } |