node tests: Get 100% coverage on topic_list_data.

This commit is contained in:
Steve Howell
2020-01-18 13:03:08 +00:00
committed by Tim Abbott
parent fa82d12525
commit f24de074d4
2 changed files with 13 additions and 2 deletions

View File

@@ -32,6 +32,7 @@ function get_list_info(zoomed) {
run_test('get_list_info w/real topic_data', () => {
clear();
let list_info;
const empty_list_info = get_list_info();
assert.deepEqual(empty_list_info, {
@@ -49,19 +50,28 @@ run_test('get_list_info w/real topic_data', () => {
});
});
const list_info = get_list_info();
narrow_state.topic = () => 'topic 6';
list_info = get_list_info();
assert.equal(list_info.items.length, 5);
assert.equal(list_info.more_topics_unreads, 0);
assert.equal(list_info.num_possible_topics, 7);
assert.deepEqual(list_info.items[0], {
is_active_topic: false,
is_active_topic: true,
is_muted: false,
is_zero: true,
topic_name: 'topic 6',
unread: 0,
url: '#narrow/stream/556-general/topic/topic.206',
});
// If we zoom in, we'll show all 7 topics.
const zoomed = true;
list_info = get_list_info(zoomed);
assert.equal(list_info.items.length, 7);
assert.equal(list_info.more_topics_unreads, 0);
assert.equal(list_info.num_possible_topics, 7);
});
run_test('get_list_info unreads', () => {

View File

@@ -80,6 +80,7 @@ enforce_fully_covered = {
'static/js/stream_sort.js',
'static/js/top_left_corner.js',
'static/js/topic_data.js',
'static/js/topic_list_data.js',
'static/js/topic_generator.js',
'static/js/transmit.js',
'static/js/typeahead_helper.js',