mirror of
https://github.com/zulip/zulip.git
synced 2026-07-06 21:18:58 +08:00
49 lines
984 B
JavaScript
49 lines
984 B
JavaScript
var assert = require('assert');
|
|
|
|
add_dependencies({
|
|
_: 'third/underscore/underscore.js',
|
|
util: 'js/util.js',
|
|
Dict: 'js/dict.js'
|
|
});
|
|
|
|
set_global('$', function () {
|
|
return {
|
|
on: function () {
|
|
return;
|
|
}
|
|
};
|
|
});
|
|
|
|
set_global('document', {
|
|
hasFocus: function () {
|
|
return true;
|
|
}
|
|
});
|
|
|
|
var activity = require('js/activity.js');
|
|
|
|
(function test_sort_users() {
|
|
var users = ['[email protected]', '[email protected]', '[email protected]'];
|
|
|
|
var user_info = {
|
|
'[email protected]': 'inactive',
|
|
'[email protected]': 'active',
|
|
'[email protected]': 'active'
|
|
};
|
|
|
|
|
|
set_global('people_dict', new global.Dict.from({
|
|
'[email protected]': 'Alice Smith',
|
|
'[email protected]': 'Fred Flintstone',
|
|
'[email protected]': 'Jill Hill'
|
|
}));
|
|
|
|
activity._sort_users(users, user_info);
|
|
|
|
assert.deepEqual(users, [
|
|
'[email protected]',
|
|
'[email protected]',
|
|
'[email protected]'
|
|
]);
|
|
}());
|