Skip to content

Commit 0709679

Browse files
committed
notif test: Be more explicit in test of switching accounts
1 parent d7e6c76 commit 0709679

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

test/notifications/open_test.dart

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -401,19 +401,24 @@ void main() {
401401
}, variant: const TargetPlatformVariant({TargetPlatform.android, TargetPlatform.iOS}));
402402
});
403403

404-
testWidgets('replaces HomePage with related account', (tester) async {
404+
testWidgets('replaces HomePage when switching account', (tester) async {
405405
addTearDown(testBinding.reset);
406406
await testBinding.globalStore.add(
407407
eg.selfAccount, eg.initialSnapshot(realmUsers: [eg.selfUser]));
408408
await testBinding.globalStore.add(
409409
eg.otherAccount, eg.initialSnapshot(realmUsers: [eg.otherUser]));
410410

411411
await prepare(tester);
412-
check(testBinding.globalStore).lastVisitedAccount.equals(eg.otherAccount);
413412

413+
// Same account as currently shown -> existing nav stack kept in place.
414+
await checkOpenNotification(tester, eg.otherAccount, eg.streamMessage(),
415+
expectHomePageReplaced: false);
416+
// Different account -> replace HomePage.
414417
await checkOpenNotification(tester, eg.selfAccount, eg.streamMessage(),
415418
expectHomePageReplaced: true);
416-
check(testBinding.globalStore).lastVisitedAccount.equals(eg.selfAccount);
419+
// Remain on that different account -> keep the new nav stack in place.
420+
await checkOpenNotification(tester, eg.selfAccount, eg.streamMessage(),
421+
expectHomePageReplaced: false);
417422
}, variant: const TargetPlatformVariant({TargetPlatform.android, TargetPlatform.iOS}));
418423
});
419424

0 commit comments

Comments
 (0)