Skip to content

Commit 49ac433

Browse files
committed
autocomplete_test [nfc]: Rename findNetworkImage to findAvatarImage
Renamed the method and changed the avatar finder implementation to check for userId instead of avatar image URL.
1 parent bcafc9d commit 49ac433

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

test/widgets/autocomplete_test.dart

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import 'package:zulip/model/localizations.dart';
99
import 'package:zulip/model/narrow.dart';
1010
import 'package:zulip/model/store.dart';
1111
import 'package:zulip/model/typing_status.dart';
12+
import 'package:zulip/widgets/content.dart';
1213
import 'package:zulip/widgets/message_list.dart';
1314

1415
import '../api/fake_api.dart';
@@ -108,18 +109,13 @@ void main() {
108109

109110
group('ComposeAutocomplete', () {
110111

111-
Finder findNetworkImage(String url) {
112-
return find.byWidgetPredicate((widget) => switch(widget) {
113-
Image(image: NetworkImage(url: var imageUrl)) when imageUrl == url
114-
=> true,
115-
_ => false,
116-
});
117-
}
112+
Finder findAvatarImage(int userId) =>
113+
find.byWidgetPredicate((widget) => widget is AvatarImage && widget.userId == userId);
118114

119115
void checkUserShown(User user, PerAccountStore store, {required bool expected}) {
120116
check(find.text(user.fullName).evaluate().length).equals(expected ? 1 : 0);
121117
final avatarFinder =
122-
findNetworkImage(store.tryResolveUrl(user.avatarUrl!).toString());
118+
findAvatarImage(user.userId);
123119
check(avatarFinder.evaluate().length).equals(expected ? 1 : 0);
124120
}
125121

0 commit comments

Comments
 (0)