node tests: Test sort_recipientbox_typeahead() in typeahead_helper.js.

This commit is contained in:
Joshua Pan 2017-06-20 14:54:37 -07:00 committed by showell
parent b48f8447e2
commit 1e4c133430
1 changed files with 28 additions and 0 deletions

View File

@ -329,3 +329,31 @@ _.each(matches, function (person) {
{ emoji_name: 'pig' },
]);
}());
(function test_sort_recipientbox_typeahead() {
var recipients = th.sort_recipientbox_typeahead("b, a", matches, "Dev"); // search "a"
var recipients_email = _.map(recipients, function (person) {
return person.email;
});
assert.deepEqual(recipients_email, [
'a_bot@zulip.com', // matches "a"
'a_user@zulip.org', // matches "a"
'b_user_2@zulip.net',
'b_user_1@zulip.net',
'zman@test.net',
'b_bot@example.com',
]);
recipients = th.sort_recipientbox_typeahead("b, a, b", matches, "Dev"); // search "b"
recipients_email = _.map(recipients, function (person) {
return person.email;
});
assert.deepEqual(recipients_email, [
'b_user_2@zulip.net',
'b_user_1@zulip.net',
'b_bot@example.com',
'a_bot@zulip.com',
'a_user@zulip.org',
'zman@test.net',
]);
}());