mirror of
https://github.com/zulip/zulip.git
synced 2026-06-21 21:32:29 +08:00
* In most cases, eslint --fix with the right comma-dangle settings was able to update the code correctly. * The exceptions were cases where the parser incorrectly treated the arguments to functions like `assert_equal` as arguments; we fixed these manually. Since this is test code, we can be reasonably confident that just fixing the failures suffices to correct any bugs introduced by making changes automatically.
67 lines
1.3 KiB
JavaScript
67 lines
1.3 KiB
JavaScript
global.stub_out_jquery();
|
|
|
|
add_dependencies({
|
|
people: 'js/people.js',
|
|
util: 'js/util.js',
|
|
});
|
|
|
|
var noop = function () {};
|
|
var people = global.people;
|
|
|
|
set_global('page_params', {
|
|
email: '[email protected]',
|
|
});
|
|
|
|
set_global('alert_words', {
|
|
process_message: noop,
|
|
});
|
|
|
|
var me = {
|
|
email: '[email protected]',
|
|
user_id: 101,
|
|
full_name: 'Me Myself',
|
|
};
|
|
|
|
var alice = {
|
|
email: '[email protected]',
|
|
user_id: 102,
|
|
full_name: 'Alice',
|
|
};
|
|
|
|
var bob = {
|
|
email: '[email protected]',
|
|
user_id: 103,
|
|
full_name: 'Bob',
|
|
};
|
|
|
|
var cindy = {
|
|
email: '[email protected]',
|
|
user_id: 104,
|
|
full_name: 'Cindy',
|
|
};
|
|
|
|
people.add_in_realm(me);
|
|
people.add_in_realm(alice);
|
|
people.add_in_realm(bob);
|
|
people.add_in_realm(cindy);
|
|
|
|
global.util.execute_early = noop;
|
|
|
|
var message_store = require('js/message_store.js');
|
|
|
|
(function test_add_message_metadata() {
|
|
var message = {
|
|
sender_email: '[email protected]',
|
|
type: 'private',
|
|
display_recipient: [me, bob, cindy],
|
|
flags: ['has_alert_word'],
|
|
};
|
|
message_store._add_message_metadata(message);
|
|
|
|
assert.equal(message.is_private, true);
|
|
assert.equal(message.reply_to, '[email protected],[email protected]');
|
|
assert.equal(message.display_reply_to, 'Bob, Cindy');
|
|
assert.equal(message.alerted, true);
|
|
assert.equal(message.is_me_message, false);
|
|
}());
|