Add test_subset_suggestions() to search_suggestion.js

(imported from commit db9173ffa92ca225baf24a1103807034e4f31a7f)
This commit is contained in:
Steve Howell 2013-08-27 19:23:42 -04:00
parent 98f7870150
commit 8363b7c59a
1 changed files with 22 additions and 0 deletions

View File

@ -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 = '';