Add test_error_handling() for reactions.js.

This commit is contained in:
Steve Howell 2017-05-30 16:09:50 -06:00 committed by Tim Abbott
parent b0b647c9e5
commit 6149111b5e
1 changed files with 29 additions and 0 deletions

View File

@ -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);
}());