Skip to content

Commit 2aca67b

Browse files
committed
inbox test [nfc]: Extract hasIcon
Signed-off-by: Zixuan James Li <[email protected]>
1 parent f8f4c9f commit 2aca67b

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

test/widgets/inbox_test.dart

+13-7
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,17 @@ void main() {
182182
));
183183
}
184184

185+
bool hasIcon(WidgetTester tester, {
186+
required Widget? parent,
187+
required IconData icon,
188+
}) {
189+
check(parent).isNotNull();
190+
return tester.widgetList(find.descendant(
191+
of: find.byWidget(parent!),
192+
matching: find.byIcon(icon),
193+
)).isNotEmpty;
194+
}
195+
185196
group('InboxPage', () {
186197
testWidgets('page builds; empty', (tester) async {
187198
await setupPage(tester, unreadMessages: []);
@@ -246,13 +257,8 @@ void main() {
246257
final subscription = eg.subscription(stream);
247258
const topic = 'lunch';
248259

249-
bool hasAtSign(WidgetTester tester, Widget? parent) {
250-
check(parent).isNotNull();
251-
return tester.widgetList(find.descendant(
252-
of: find.byWidget(parent!),
253-
matching: find.byIcon(ZulipIcons.at_sign),
254-
)).isNotEmpty;
255-
}
260+
bool hasAtSign(WidgetTester tester, Widget? parent) =>
261+
hasIcon(tester, parent: parent, icon: ZulipIcons.at_sign);
256262

257263
testWidgets('topic with a mention', (tester) async {
258264
await setupPage(tester,

0 commit comments

Comments
 (0)