@@ -404,19 +404,33 @@ void main() {
404
404
});
405
405
406
406
group ('MentionAutocompleteQuery.testUser' , () {
407
+ late PerAccountStore store;
408
+
407
409
void doCheck (String rawQuery, User user, bool expected) {
408
410
final result = MentionAutocompleteQuery (rawQuery)
409
- .testUser (user, AutocompleteDataCache ());
411
+ .testUser (user, AutocompleteDataCache (), store );
410
412
expected ? check (result).isTrue () : check (result).isFalse ();
411
413
}
412
414
413
415
test ('user is always excluded when not active regardless of other criteria' , () {
416
+ store = eg.store ();
417
+
414
418
doCheck ('Full Name' , eg.user (fullName: 'Full Name' , isActive: false ), false );
415
419
// When active then other criteria will be checked
416
420
doCheck ('Full Name' , eg.user (fullName: 'Full Name' , isActive: true ), true );
417
421
});
418
422
423
+ test ('user is always excluded when muted, regardless of other criteria' , () async {
424
+ store = eg.store ();
425
+ await store.setMutedUsers ([1 ]);
426
+ doCheck ('Full Name' , eg.user (userId: 1 , fullName: 'Full Name' ), false );
427
+ // When not muted, then other criteria will be checked
428
+ doCheck ('Full Name' , eg.user (userId: 2 , fullName: 'Full Name' ), true );
429
+ });
430
+
419
431
test ('user is included if fullname words match the query' , () {
432
+ store = eg.store ();
433
+
420
434
doCheck ('' , eg.user (fullName: 'Full Name' ), true );
421
435
doCheck ('' , eg.user (fullName: '' ), true ); // Unlikely case, but should not crash
422
436
doCheck ('Full Name' , eg.user (fullName: 'Full Name' ), true );
0 commit comments