tests: Convert topics from object to Map.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
This commit is contained in:
Anders Kaseorg 2020-02-11 23:22:43 -08:00 committed by Tim Abbott
parent 68ddfec78c
commit 5daf6f274f
1 changed files with 7 additions and 7 deletions

View File

@ -215,19 +215,19 @@ run_test('streams', () => {
run_test('topics', () => {
const streams = [1, 2, 3, 4];
const topics = {};
topics[1] = ['read', 'read', '1a', '1b', 'read', '1c'];
topics[2] = [];
topics[3] = ['3a', 'read', 'read', '3b', 'read'];
topics[4] = ['4a'];
const topics = new Map([
[1, ['read', 'read', '1a', '1b', 'read', '1c']],
[2, []],
[3, ['3a', 'read', 'read', '3b', 'read']],
[4, ['4a']],
]);
function has_unread_messages(stream, topic) {
return topic !== 'read';
}
function get_topics(stream) {
return topics[stream];
return topics.get(stream);
}
function next_topic(curr_stream, curr_topic) {