Skip to content

Commit

Permalink
autocomplete test: Tighten up "final results" test
Browse files Browse the repository at this point in the history
The recent changes that added two new ranking criteria added four
new users to this test case.  Two is enough to make the test's point,
because it's enough for adding users that differ on the new criteria
while tying on the criteria that have higher priority in the ranking.
  • Loading branch information
gnprice committed Aug 9, 2024
1 parent 093eaba commit e51d2f2
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions test/model/autocomplete_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -705,8 +705,6 @@ void main() {
eg.user(userId: 5, fullName: 'User Five'),
eg.user(userId: 6, fullName: 'User Six', isBot: true),
eg.user(userId: 7, fullName: 'User Seven'),
eg.user(userId: 8, fullName: 'User Xy', isBot: true),
eg.user(userId: 9, fullName: 'User Xz', isBot: true),
];

await prepare(users: users, messages: [
Expand All @@ -723,19 +721,15 @@ void main() {
// 1. Users most recent in the current topic/stream.
// 2. Users most recent in the DM conversations.
// 3. Human vs. Bot users (human users come first).
// 4. Alphabetical order.
// 4. Alphabetical order by name.
check(await getResults(topicNarrow, MentionAutocompleteQuery('')))
.deepEquals([1, 5, 4, 2, 7, 3, 6, 8, 9]);
.deepEquals([1, 5, 4, 2, 7, 3, 6]);

// Check the ranking applies also to results filtered by a query.
check(await getResults(topicNarrow, MentionAutocompleteQuery('t')))
.deepEquals([2, 3]);
check(await getResults(topicNarrow, MentionAutocompleteQuery('f')))
.deepEquals([5, 4]);
check(await getResults(topicNarrow, MentionAutocompleteQuery('s')))
.deepEquals([7, 6]);
check(await getResults(topicNarrow, MentionAutocompleteQuery('user x')))
.deepEquals([8, 9]);
});
});
}

0 comments on commit e51d2f2

Please sign in to comment.