Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Add failing unit test, add trim() to make test pass #33

Merged
merged 1 commit into from

2 participants

@Havvy
Owner

Trying to merge to master instead.

@Havvy Havvy merged commit c6ec509 into master

1 check passed

Details default The Travis CI build passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jan 20, 2014
  1. @metalbot
This page is out of date. Refresh to see the latest.
Showing with 31 additions and 3 deletions.
  1. +1 −1  lib/message.js
  2. +16 −1 test-src/message.sjs
  3. +14 −1 test/message.js
View
2  lib/message.js
@@ -128,7 +128,7 @@ var extensions = {
// :<server> 353 <me> = <channel> :<nicknames>
message.replyname = "RPL_NAMREPLY";
message.channel = message.params[2];
- message.nicknames = message.params[3].split(" ");
+ message.nicknames = message.params[3].trim().split(" ");
},
"366": function (message) {
View
17 test-src/message.sjs
@@ -15,6 +15,9 @@ var arg1 = 'arg-1';
var arg2 = 'arg-2';
var restargs = 'rest arguments';
var reason = 'Because I want to.';
+var nick1 = "adam";
+var nick2 = "beatrice";
+var nick3 = "charlie";
var messages = {
generic: format('GENERIC'),
@@ -33,7 +36,8 @@ var messages = {
part_reason: format(':%s PART %s :%s', hostmask, channel, reason),
quit: format(':%s QUIT', hostmask),
- quit_reason: format(':%s QUIT :%s', hostmask, reason)
+ quit_reason: format(':%s QUIT :%s', hostmask, reason),
+ a_353_with_whitespace: format(':%s 353 %s = %s :%s %s %s ', server, nickname, channel, nick1, nick2, nick3)
};
describe 'Message' {
@@ -168,5 +172,16 @@ describe 'Message' {
assert(message.hasOwnProperty('reason'));
}
}
+
+ describe '353:' {
+ it 'creates correct nicknames array' {
+ var message = Message(messages.a_353_with_whitespace, receiver);
+
+ assert(message.nicknames.length === 3);
+ assert(message.nicknames[0] === "adam");
+ assert(message.nicknames[1] === "beatrice");
+ assert(message.nicknames[2] === "charlie");
+ }
+ }
}
}
View
15 test/message.js
@@ -20,6 +20,9 @@ var arg1 = 'arg-1';
var arg2 = 'arg-2';
var restargs = 'rest arguments';
var reason = 'Because I want to.';
+var nick1 = 'adam';
+var nick2 = 'beatrice';
+var nick3 = 'charlie';
var messages = {
generic: format('GENERIC'),
generic_args: format('GENERIC %s %s :%s', arg1, arg2, restargs),
@@ -33,7 +36,8 @@ var messages = {
part: format(':%s PART %s', hostmask, channel),
part_reason: format(':%s PART %s :%s', hostmask, channel, reason),
quit: format(':%s QUIT', hostmask),
- quit_reason: format(':%s QUIT :%s', hostmask, reason)
+ quit_reason: format(':%s QUIT :%s', hostmask, reason),
+ a_353_with_whitespace: format(':%s 353 %s = %s :%s %s %s ', server, nickname, channel, nick1, nick2, nick3)
};
describe('Message', function () {
describe('common properties', function () {
@@ -155,5 +159,14 @@ describe('Message', function () {
assert(message.hasOwnProperty('reason'));
});
});
+ describe('353:', function () {
+ it('creates correct nicknames array', function () {
+ var message = Message(messages.a_353_with_whitespace, receiver);
+ assert(message.nicknames.length === 3);
+ assert(message.nicknames[0] === 'adam');
+ assert(message.nicknames[1] === 'beatrice');
+ assert(message.nicknames[2] === 'charlie');
+ });
+ });
});
});
Something went wrong with that request. Please try again.