Skip to content

Commit a5b3cc8

Browse files
committed
autocomplete test: Check both directions in compareByRecency tests
1 parent 3c7096f commit a5b3cc8

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

test/model/autocomplete_test.dart

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,8 +399,16 @@ void main() {
399399
}
400400

401401
int compareAB({required String? topic}) {
402-
return MentionAutocompleteView.compareByRecency(userA, userB,
402+
final resultAB = MentionAutocompleteView.compareByRecency(userA, userB,
403403
streamId: stream.streamId, topic: topic, store: store);
404+
final resultBA = MentionAutocompleteView.compareByRecency(userB, userA,
405+
streamId: stream.streamId, topic: topic, store: store);
406+
switch (resultAB) {
407+
case <0: check(resultBA).isGreaterThan(0);
408+
case >0: check(resultBA).isLessThan(0);
409+
default: check(resultBA).equals(0);
410+
}
411+
return resultAB;
404412
}
405413

406414
test('prioritizes the user with more recent activity in the topic', () async {

0 commit comments

Comments
 (0)