mirror of https://github.com/zulip/zulip.git
Add test_error_handling() for reactions.js.
This commit is contained in:
parent
b0b647c9e5
commit
6149111b5e
|
@ -307,3 +307,32 @@ set_global('message_store', {
|
|||
assert(!reaction_element.hasClass('reacted'));
|
||||
|
||||
}());
|
||||
|
||||
(function test_error_handling() {
|
||||
var error_msg;
|
||||
|
||||
global.message_store.get = function () {
|
||||
return;
|
||||
};
|
||||
|
||||
global.blueslip.error = function (msg) {
|
||||
error_msg = msg;
|
||||
};
|
||||
|
||||
var bogus_event = {
|
||||
message_id: 55,
|
||||
emoji_name: 'realm_emoji',
|
||||
user: {
|
||||
user_id: 99,
|
||||
},
|
||||
};
|
||||
reactions.toggle_emoji_reaction(55);
|
||||
assert.equal(error_msg, 'reactions: Bad message id: 55');
|
||||
|
||||
error_msg = undefined;
|
||||
reactions.add_reaction(bogus_event);
|
||||
assert.equal(error_msg, undefined);
|
||||
|
||||
reactions.remove_reaction(bogus_event);
|
||||
assert.equal(error_msg, undefined);
|
||||
}());
|
||||
|
|
Loading…
Reference in New Issue