Added test coverage for search suggestion descriptions.

(imported from commit 1693ad7343106deab0c8f2838088d27b407e39eb)
This commit is contained in:
Steve Howell 2013-07-30 16:39:32 -04:00
parent 95102dc1bd
commit c6aeeafe1d
1 changed files with 25 additions and 0 deletions

View File

@ -93,6 +93,16 @@ var search = set_up_dependencies();
];
assert.deepEqual(suggestions.strings, expected);
function describe(q) {
return suggestions.lookup_table[q].description;
}
assert.equal(describe('in:all'), 'All messages');
assert.equal(describe('is:private'), 'Private messages');
assert.equal(describe('is:starred'), 'Starred messages');
assert.equal(describe('is:mentioned'), '@-mentions');
assert.equal(describe('sender:bob@zulip.com'), 'Sent by me');
assert.equal(describe('stream:devel'), 'Narrow to stream <strong>devel</strong>');
}());
(function test_topic_suggestions() {
@ -124,6 +134,13 @@ var search = set_up_dependencies();
];
assert.deepEqual(suggestions.strings, expected);
function describe(q) {
return suggestions.lookup_table[q].description;
}
assert.equal(describe('te'), "Search for te");
assert.equal(describe('stream:office topic:team'), "Narrow to office > team");
}());
@ -167,4 +184,12 @@ var search = set_up_dependencies();
];
assert.deepEqual(suggestions.strings, expected);
function describe(q) {
return suggestions.lookup_table[q].description;
}
assert.equal(describe('pm-with:ted@zulip.com'),
"Narrow to private messages with <strong>Te</strong>d Smith &lt;<strong>te</strong>d@zulip.com&gt;");
assert.equal(describe('sender:ted@zulip.com'),
"Narrow to messages sent by <strong>Te</strong>d Smith &lt;<strong>te</strong>d@zulip.com&gt;");
}());