Add unit tests for composebox_typeahead.add_topic().

This tests topics_seen_for() as well.

(imported from commit a748134af8068d9e4ae223fb7ecbbbc6c170137e)
This commit is contained in:
Steve Howell 2013-08-14 15:54:34 -04:00
parent e51cfeaed4
commit a4af6c7062
2 changed files with 19 additions and 0 deletions

View File

@ -392,3 +392,6 @@ exports.initialize = function () {
return exports;
}());
if (typeof module !== 'undefined') {
module.exports = composebox_typeahead;
}

View File

@ -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']);
}());