Skip to content

Commit 8e21b6f

Browse files
committed
Add tests
1 parent 9cf2ba1 commit 8e21b6f

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

tests/conftest.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,7 @@ def empty_index():
479479
pm_template['id']: pm_template,
480480
group_pm_template['id']: group_pm_template,
481481
}),
482-
'unread_msgs': set()
482+
'unread_msg_ids': set()
483483
})
484484

485485

@@ -524,6 +524,11 @@ def index_user(empty_index):
524524
return dict(empty_index, **diff)
525525

526526

527+
@pytest.fixture
528+
def index_unread_message_ids():
529+
return {1, 2, 3, 4, 5, 6, 7, 11, 12, 13, 101, 102}
530+
531+
527532
@pytest.fixture
528533
def index_user_multiple(empty_index):
529534
"""

tests/helper/test_helper.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -177,14 +177,17 @@ def test_powerset(iterable, map_func, expected_powerset):
177177
)
178178
def test_classify_unread_counts(mocker, initial_data, stream_dict,
179179
classified_unread_counts, muted_topics,
180-
muted_streams, vary_in_unreads):
180+
muted_streams, vary_in_unreads, initial_index,
181+
index_unread_message_ids):
181182
model = mocker.Mock()
182183
model.stream_dict = stream_dict
183184
model.initial_data = initial_data
184185
model.muted_topics = muted_topics
185186
model.muted_streams = muted_streams
186-
assert classify_unread_counts(model) == dict(classified_unread_counts,
187-
**vary_in_unreads)
187+
model.index = initial_index
188+
assert classify_unread_counts(model) == dict(
189+
classified_unread_counts, **vary_in_unreads)
190+
assert model.index['unread_msg_ids'] == index_unread_message_ids
188191

189192

190193
@pytest.mark.parametrize('color', [

0 commit comments

Comments
 (0)