diff --git a/frontend_tests/node_tests/message_store.js b/frontend_tests/node_tests/message_store.js index 0039ea4535..43fc237fd3 100644 --- a/frontend_tests/node_tests/message_store.js +++ b/frontend_tests/node_tests/message_store.js @@ -184,6 +184,12 @@ run_test('update_booleans', () => { assert.equal(message.unread, true); }); +run_test('each', () => { + message_store.each((message) => { + assert(message.alerted !== undefined); + }); +}); + run_test('message_id_change', () => { var message = { sender_email: 'me@example.com', diff --git a/static/js/message_store.js b/static/js/message_store.js index 441d6b0b11..426e9082d6 100644 --- a/static/js/message_store.js +++ b/static/js/message_store.js @@ -7,6 +7,12 @@ exports.get = function get(message_id) { return stored_messages[message_id]; }; +exports.each = function (f) { + _.each(stored_messages, function (message) { + f(message); + }); +}; + exports.get_pm_emails = function (message) { function email(user_id) {