Skip to content

Commit 0288ee4

Browse files
committed
autocomplete test: Test ranking applies in presence of filters, too
1 parent 2b8d848 commit 0288ee4

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

test/model/autocomplete_test.dart

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -583,7 +583,13 @@ void main() {
583583
const topic = 'topic';
584584
final topicNarrow = TopicNarrow(stream.streamId, topic);
585585

586-
final users = List.generate(5, (i) => eg.user(userId: 1 + i));
586+
final users = [
587+
eg.user(userId: 1, fullName: 'User One'),
588+
eg.user(userId: 2, fullName: 'User Two'),
589+
eg.user(userId: 3, fullName: 'User Three'),
590+
eg.user(userId: 4, fullName: 'User Four'),
591+
eg.user(userId: 5, fullName: 'User Five'),
592+
];
587593

588594
final dmConversations = [
589595
RecentDmConversation(userIds: [4], maxMessageId: 300),
@@ -630,8 +636,14 @@ void main() {
630636

631637
await prepareStore();
632638
await fetchInitialMessagesIn(topicNarrow);
639+
// Check the ranking of the full list of users.
633640
check(await getResults(topicNarrow, MentionAutocompleteQuery('')))
634641
.deepEquals([1, 5, 4, 2, 3]);
642+
// Check the ranking applies also to results filtered by a query.
643+
check(await getResults(topicNarrow, MentionAutocompleteQuery('t')))
644+
.deepEquals([2, 3]);
645+
check(await getResults(topicNarrow, MentionAutocompleteQuery('f')))
646+
.deepEquals([5, 4]);
635647
});
636648
});
637649
}

0 commit comments

Comments
 (0)