Skip to content

Commit 5285123

Browse files
committed
subscription_list test: Set up whole ZulipApp, not just MaterialApp
Just like we did for the InboxPage tests, in the previous commit. Here, there's one test that failed on the assumption that a particular icon was the only one in view; it apparently isn't anymore (probably because of the page's back button), and that assumption isn't important to the goal of the test. So, we adapt by removing that assumption. Related: #393
1 parent 09193a0 commit 5285123

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

test/widgets/subscription_list_test.dart

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ import 'package:flutter/material.dart';
33
import 'package:flutter_test/flutter_test.dart';
44
import 'package:zulip/api/model/initial_snapshot.dart';
55
import 'package:zulip/api/model/model.dart';
6-
import 'package:zulip/widgets/store.dart';
6+
import 'package:zulip/widgets/app.dart';
7+
import 'package:zulip/widgets/icons.dart';
78
import 'package:zulip/widgets/subscription_list.dart';
89
import 'package:zulip/widgets/unread_count_badge.dart';
910

@@ -28,12 +29,10 @@ void main() {
2829
);
2930
await testBinding.globalStore.add(eg.selfAccount, initialSnapshot);
3031

31-
await tester.pumpWidget(
32-
MaterialApp(
33-
home: GlobalStoreWidget(
34-
child: PerAccountStoreWidget(
35-
accountId: eg.selfAccount.id,
36-
child: const SubscriptionListPage()))));
32+
await tester.pumpWidget(const ZulipApp());
33+
await tester.pump();
34+
final navigator = await ZulipApp.navigator;
35+
navigator.push(SubscriptionListPage.buildRoute(accountId: eg.selfAccount.id));
3736

3837
// global store, per-account store
3938
await tester.pumpAndSettle();
@@ -185,7 +184,7 @@ void main() {
185184
subscription,
186185
], unreadMsgs: unreadMsgs);
187186
check(getItemCount()).equals(1);
188-
check(tester.widget<Icon>(find.byType(Icon)).color)
187+
check(tester.widget<Icon>(find.byIcon(iconDataForStream(stream))).color)
189188
.equals(swatch.iconOnPlainBackground);
190189
check(tester.widget<UnreadCountBadge>(find.byType(UnreadCountBadge)).backgroundColor)
191190
.equals(swatch);

0 commit comments

Comments
 (0)