mirror of
https://github.com/zulip/zulip.git
synced 2026-07-15 21:03:26 +08:00
The functions add_dependencies() and set_global() are convenience methods that allow you to modify the global namespace while the current file is running but then have it be cleaned up by index.js when you're done. (imported from commit f75b8a10c19f773a8d2d3a8fa4bc39b1679566fe)
35 lines
788 B
JavaScript
35 lines
788 B
JavaScript
var assert = require('assert');
|
|
|
|
add_dependencies({
|
|
_: 'third/underscore/underscore.js',
|
|
util: 'js/util.js',
|
|
Dict: 'js/dict.js'
|
|
});
|
|
|
|
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]'
|
|
]);
|
|
}());
|