mirror of https://github.com/zulip/zulip.git
Add unit tests for composebox_typeahead.add_topic().
This tests topics_seen_for() as well. (imported from commit a748134af8068d9e4ae223fb7ecbbbc6c170137e)
This commit is contained in:
parent
e51cfeaed4
commit
a4af6c7062
|
@ -392,3 +392,6 @@ exports.initialize = function () {
|
|||
return exports;
|
||||
|
||||
}());
|
||||
if (typeof module !== 'undefined') {
|
||||
module.exports = composebox_typeahead;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
var assert = require('assert');
|
||||
|
||||
global._ = require('third/underscore/underscore.js');
|
||||
global.util = require('js/util.js');
|
||||
global.Dict = require('js/dict.js');
|
||||
var ct = global.composebox_typeahead = require('js/composebox_typeahead.js');
|
||||
|
||||
(function test_add_topic () {
|
||||
ct.add_topic('Denmark', 'civil fears');
|
||||
ct.add_topic('devel', 'fading');
|
||||
ct.add_topic('denmark', 'acceptance');
|
||||
ct.add_topic('denmark', 'Acceptance');
|
||||
ct.add_topic('Denmark', 'With Twisted Metal');
|
||||
|
||||
assert.deepEqual(ct.topics_seen_for('Denmark'), ['With Twisted Metal', 'acceptance', 'civil fears']);
|
||||
}());
|
Loading…
Reference in New Issue