node tests: Cover exports.user_is_subscribed.

This commit is contained in:
Jerry Zhang 2017-12-03 09:46:30 -08:00 committed by showell
parent a30152cb94
commit b874693242
1 changed files with 10 additions and 0 deletions

View File

@ -201,6 +201,16 @@ zrequire('stream_data');
stream_data.update_subscribers_count(sub);
assert.equal(sub.subscriber_count, 0);
// verify that checking subscription with bad email is a noop
var bad_email = 'notbrutus@zulip.org';
global.blueslip.error = function (msg) {
assert.equal(msg, "Unknown email for get_user_id: " + bad_email);
};
global.blueslip.warn = function (msg) {
assert.equal(msg, "Bad email passed to user_is_subscribed: " + bad_email);
};
assert(!stream_data.user_is_subscribed('Rome', bad_email));
// Defensive code will give warnings, which we ignore for the
// tests, but the defensive code needs to not actually blow up.
global.blueslip.warn = function () {};