@@ -24,31 +24,31 @@ void main() {
24
24
group ('ZulipApp initial navigation' , () {
25
25
late List <Route <dynamic >> pushedRoutes = [];
26
26
27
- Future <List <Route <dynamic >>> initialRoutes (WidgetTester tester) async {
27
+ Future <void > prepare (WidgetTester tester) async {
28
+ addTearDown (testBinding.reset);
29
+
28
30
pushedRoutes = [];
29
31
final testNavObserver = TestNavigatorObserver ()
30
32
..onPushed = (route, prevRoute) => pushedRoutes.add (route);
31
33
await tester.pumpWidget (ZulipApp (navigatorObservers: [testNavObserver]));
32
34
await tester.pump ();
33
- return pushedRoutes;
34
35
}
35
36
36
37
testWidgets ('when no accounts, go to choose account' , (tester) async {
37
- addTearDown (testBinding.reset );
38
- check (await initialRoutes (tester) ).deepEquals (< Condition <Object ?>> [
38
+ await prepare (tester );
39
+ check (pushedRoutes ).deepEquals (< Condition <Object ?>> [
39
40
(it) => it.isA <WidgetRoute >().page.isA <ChooseAccountPage >(),
40
41
]);
41
42
});
42
43
43
44
testWidgets ('when have accounts, go to inbox for first account' , (tester) async {
44
- addTearDown (testBinding.reset);
45
-
46
45
// We'll need per-account data for the account that a page will be opened
47
46
// for, but not for the other account.
48
47
await testBinding.globalStore.add (eg.selfAccount, eg.initialSnapshot ());
49
48
await testBinding.globalStore.insertAccount (eg.otherAccount.toCompanion (false ));
49
+ await prepare (tester);
50
50
51
- check (await initialRoutes (tester) ).deepEquals (< Condition <Object ?>> [
51
+ check (pushedRoutes ).deepEquals (< Condition <Object ?>> [
52
52
(it) => it.isA <WidgetRoute >().page.isA <ChooseAccountPage >(),
53
53
(it) => it.isA <MaterialAccountWidgetRoute >()
54
54
..accountId.equals (eg.selfAccount.id)
0 commit comments