node tests: Fix missing coverage on stream_data.js.

This fixes a testing coverage regression in
d5f005fd61.
This commit is contained in:
Tim Abbott 2019-12-09 18:11:12 -08:00
parent c6fe6cf0a4
commit fa7ae6fa7f
1 changed files with 33 additions and 0 deletions

View File

@ -601,6 +601,9 @@ run_test('notifications', () => {
subscribed: true, subscribed: true,
desktop_notifications: null, desktop_notifications: null,
audible_notifications: null, audible_notifications: null,
email_notifications: null,
push_notifications: null,
wildcard_mentions_notify: null,
}; };
stream_data.clear_subscriptions(); stream_data.clear_subscriptions();
stream_data.add_sub('India', india); stream_data.add_sub('India', india);
@ -629,6 +632,36 @@ run_test('notifications', () => {
page_params.enable_stream_audible_notifications = true; page_params.enable_stream_audible_notifications = true;
assert(!stream_data.receives_notifications('India', "desktop_notifications")); assert(!stream_data.receives_notifications('India', "desktop_notifications"));
assert(!stream_data.receives_notifications('India', "audible_notifications")); assert(!stream_data.receives_notifications('India', "audible_notifications"));
page_params.wildcard_mentions_notify = true;
assert(stream_data.receives_notifications('India', "wildcard_mentions_notify"));
page_params.wildcard_mentions_notify = false;
assert(!stream_data.receives_notifications('India', "wildcard_mentions_notify"));
india.wildcard_mentions_notify = true;
assert(stream_data.receives_notifications('India', "wildcard_mentions_notify"));
page_params.wildcard_mentions_notify = true;
india.wildcard_mentions_notify = false;
assert(!stream_data.receives_notifications('India', "wildcard_mentions_notify"));
page_params.enable_stream_push_notifications = true;
assert(stream_data.receives_notifications('India', "push_notifications"));
page_params.enable_stream_push_notifications = false;
assert(!stream_data.receives_notifications('India', "push_notifications"));
india.push_notifications = true;
assert(stream_data.receives_notifications('India', "push_notifications"));
page_params.enable_stream_push_notifications = true;
india.push_notifications = false;
assert(!stream_data.receives_notifications('India', "push_notifications"));
page_params.enable_stream_email_notifications = true;
assert(stream_data.receives_notifications('India', "email_notifications"));
page_params.enable_stream_email_notifications = false;
assert(!stream_data.receives_notifications('India', "email_notifications"));
india.email_notifications = true;
assert(stream_data.receives_notifications('India', "email_notifications"));
page_params.enable_stream_email_notifications = true;
india.email_notifications = false;
assert(!stream_data.receives_notifications('India', "email_notifications"));
}); });
run_test('is_muted', () => { run_test('is_muted', () => {