diff --git a/application/test/presentation/discovery_feed/discovery_feed_manager_test.dart b/application/test/presentation/discovery_feed/discovery_feed_manager_test.dart index 958c02f6c..e99424329 100644 --- a/application/test/presentation/discovery_feed/discovery_feed_manager_test.dart +++ b/application/test/presentation/discovery_feed/discovery_feed_manager_test.dart @@ -133,8 +133,8 @@ void main() async { .cards) .toSet()); when(surveyCardInjectionUseCase.toCards(any)).thenAnswer((realInvocation) => - (realInvocation.positionalArguments.first as Set? ?? const {}) - .map(item_renderer.Card.document)); + (realInvocation.positionalArguments.first as Set? ?? + const {})); di.reset(); @@ -160,6 +160,7 @@ void main() async { await eventsController.close(); await engine.dispose(); await manager.close(); + await tearDownWidgetTest(); }); blocTest( @@ -182,7 +183,6 @@ void main() async { verifyNoMoreInteractions(mockDiscoveryEngine); }, ); - blocTest( 'WHEN feed card index changes THEN store the new index in the repository ', build: () => manager, @@ -193,20 +193,20 @@ void main() async { await manager.stream.firstWhere((it) => it.cards.isNotEmpty); }, act: (manager) async => manager.handleIndexChanged(1), - expect: () => [ - DiscoveryState( - cards: { - item_renderer.Card.document(fakeDocumentA), - item_renderer.Card.document(fakeDocumentB), - }, - cardIndex: 1, - isComplete: true, - isFullScreen: false, - didReachEnd: false, - subscriptionStatus: null, - ), - ], verify: (manager) { + expect( + manager.state, + DiscoveryState( + cards: { + item_renderer.Card.document(fakeDocumentA), + item_renderer.Card.document(fakeDocumentB), + }, + cardIndex: 1, + isComplete: true, + isFullScreen: false, + didReachEnd: false, + subscriptionStatus: null, + )); verifyInOrder([ // when manager inits feedRepository.get(), @@ -305,6 +305,7 @@ void main() async { .thenAnswer((_) async => Session.withFeedRequested()), act: (manager) async { manager.handleNavigateIntoCard(fakeDocumentA); + await manager.stream.firstWhere((it) => it.isComplete); }, verify: (manager) { expect( @@ -314,8 +315,8 @@ void main() async { item_renderer.Card.document(fakeDocumentA), item_renderer.Card.document(fakeDocumentB), }, - cardIndex: 0, - isComplete: false, + cardIndex: 1, + isComplete: true, isFullScreen: true, shouldUpdateNavBar: false, didReachEnd: false,