From b874693242e45135ebffa3a7866cad9a0b237c9f Mon Sep 17 00:00:00 2001 From: Jerry Zhang Date: Sun, 3 Dec 2017 09:46:30 -0800 Subject: [PATCH] node tests: Cover exports.user_is_subscribed. --- frontend_tests/node_tests/stream_data.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/frontend_tests/node_tests/stream_data.js b/frontend_tests/node_tests/stream_data.js index bd2b7d6e43..aaa0926dec 100644 --- a/frontend_tests/node_tests/stream_data.js +++ b/frontend_tests/node_tests/stream_data.js @@ -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 () {};