diff --git a/frontend_tests/node_tests/stream_data.js b/frontend_tests/node_tests/stream_data.js index 71643ea900..17a2960cf7 100644 --- a/frontend_tests/node_tests/stream_data.js +++ b/frontend_tests/node_tests/stream_data.js @@ -674,3 +674,32 @@ zrequire('marked', 'third/marked/lib/marked'); new_members.subscribed = false; assert.equal(stream_data.get_newbie_stream(), undefined); }()); + +(function test_invite_streams() { + // add default stream + var orie = { + stream_id: 320, + name: 'Orie', + subscribed: true, + }; + + // clear all the data form stream_data, and people + stream_data.clear_subscriptions(); + people.init(); + + stream_data.add_sub('Orie', orie); + stream_data.set_realm_default_streams([orie]); + + var expected_list = ['Orie']; + assert.deepEqual(stream_data.invite_streams(), expected_list); + + var inviter = { + stream_id: 25, + name: 'Inviter', + subscribed: true, + }; + stream_data.add_sub('Inviter', inviter); + + expected_list.push('Inviter'); + assert.deepEqual(stream_data.invite_streams(), expected_list); +}()); diff --git a/tools/test-js-with-node b/tools/test-js-with-node index 441d6b1491..f81b6de9c7 100755 --- a/tools/test-js-with-node +++ b/tools/test-js-with-node @@ -49,6 +49,7 @@ enforce_fully_covered = { 'static/js/recent_senders.js', 'static/js/rtl.js', 'static/js/search_suggestion.js', + 'static/js/stream_data.js', 'static/js/stream_events.js', 'static/js/stream_sort.js', 'static/js/topic_data.js',