node tests: Cover stream_data.get_newbie_stream.

This commit is contained in:
cPhost 2017-12-22 08:59:10 -05:00 committed by showell
parent e62d9742aa
commit 0966f4737b
1 changed files with 30 additions and 0 deletions

View File

@ -635,3 +635,33 @@ zrequire('marked', 'third/marked/lib/marked');
assert.equal(page_params.notifications_stream, "foo"); assert.equal(page_params.notifications_stream, "foo");
}()); }());
(function test_get_newbie_stream() {
var newbie = {
name: 'newbie',
stream_id: 234,
subscribed: true,
in_home_view: true,
};
var new_members = {
subscribed: true,
name: 'new members',
stream_id: 531,
};
assert.equal(stream_data.get_newbie_stream(), undefined);
stream_data.add_sub('newbie', newbie);
page_params.notifications_stream = 'newbie';
assert.equal(stream_data.get_newbie_stream(), 'newbie');
newbie.in_home_view = false;
assert.equal(stream_data.get_newbie_stream(), undefined);
stream_data.add_sub('new members', new_members);
assert.equal(stream_data.get_newbie_stream(), 'new members');
new_members.subscribed = false;
assert.equal(stream_data.get_newbie_stream(), undefined);
}());