2013-08-09 14:42:49 +02:00
|
|
|
var assert = require('assert');
|
|
|
|
|
|
|
|
(function set_up_dependencies () {
|
|
|
|
global._ = require('third/underscore/underscore.js');
|
|
|
|
global.activity = require('js/activity.js');
|
|
|
|
global.util = require('js/util.js');
|
2013-08-07 23:56:51 +02:00
|
|
|
global.Dict = require('js/dict.js');
|
2013-08-09 14:42:49 +02:00
|
|
|
}());
|
|
|
|
|
|
|
|
var activity = global.activity;
|
|
|
|
|
|
|
|
(function test_sort_users() {
|
|
|
|
var users = ['alice@zulip.com', 'fred@zulip.com', 'jill@zulip.com'];
|
|
|
|
|
|
|
|
var user_info = {
|
|
|
|
'alice@zulip.com': 'inactive',
|
|
|
|
'fred@zulip.com': 'active',
|
|
|
|
'jill@zulip.com': 'active'
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2013-08-07 23:56:51 +02:00
|
|
|
global.people_dict = new global.Dict({
|
2013-08-09 14:42:49 +02:00
|
|
|
'alice@zulip.com': 'Alice Smith',
|
|
|
|
'fred@zulip.com': 'Fred Flintstone',
|
|
|
|
'jill@zulip.com': 'Jill Hill'
|
2013-08-07 23:56:51 +02:00
|
|
|
});
|
2013-08-09 14:42:49 +02:00
|
|
|
|
|
|
|
activity._sort_users(users, user_info);
|
|
|
|
|
|
|
|
assert.deepEqual(users, [
|
|
|
|
'fred@zulip.com',
|
|
|
|
'jill@zulip.com',
|
|
|
|
'alice@zulip.com'
|
|
|
|
]);
|
|
|
|
}());
|