From 8363b7c59ab7d9ae4744e94add2309361c9f1770 Mon Sep 17 00:00:00 2001 From: Steve Howell Date: Tue, 27 Aug 2013 19:23:42 -0400 Subject: [PATCH] Add test_subset_suggestions() to search_suggestion.js (imported from commit db9173ffa92ca225baf24a1103807034e4f31a7f) --- .../tests/frontend/node/search_suggestion.js | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/zerver/tests/frontend/node/search_suggestion.js b/zerver/tests/frontend/node/search_suggestion.js index 916125afad..cef1d3b8b9 100644 --- a/zerver/tests/frontend/node/search_suggestion.js +++ b/zerver/tests/frontend/node/search_suggestion.js @@ -51,6 +51,28 @@ set_global('narrow', {}); assert.deepEqual(suggestions.strings, expected); }()); +(function test_subset_suggestions() { + var query = 'stream:Denmark topic:Hamlet shakespeare'; + + global.stream_data.subscribed_streams = function () { + return []; + }; + + global.narrow.stream = function () { + return undefined; + }; + + var suggestions = search.get_suggestions(query); + + var expected = [ + "stream:Denmark topic:Hamlet shakespeare", + "stream:Denmark topic:Hamlet", + "stream:Denmark" + ]; + + assert.deepEqual(suggestions.strings, expected); +}()); + (function test_empty_query_suggestions() { var query = '';