feat(tests): added new tests and updated fixtures

This commit is contained in:
misha
2026-02-10 08:02:50 +03:00
parent c91e83adaf
commit f81aebe9d8
16 changed files with 591 additions and 102 deletions

View File

@@ -193,5 +193,36 @@ void main() {
expect(find.byType(AboutRecipeScreen), findsOneWidget);
});
testWidgets('renders with navigateToComments true', (tester) async {
final recipeCubit = MockAboutRecipeCubit();
final feedCubit = MockFeedCubit();
final commentsCubit = MockCommentsCubit();
final state = AboutRecipeState.loaded(recipe: testRecipe);
when(recipeCubit.state).thenReturn(state);
when(recipeCubit.stream).thenAnswer((_) => const Stream<AboutRecipeState>.empty());
when(recipeCubit.close()).thenAnswer((_) async => Future<void>.value());
when(feedCubit.viewRecipe(any)).thenAnswer((_) async => Future<void>.value());
when(feedCubit.stream).thenAnswer((_) => const Stream.empty());
when(feedCubit.close()).thenAnswer((_) async => Future<void>.value());
when(commentsCubit.state).thenReturn(const CommentsState());
when(commentsCubit.stream).thenAnswer((_) => const Stream<CommentsState>.empty());
when(commentsCubit.close()).thenAnswer((_) async => Future<void>.value());
when(commentsCubit.getComments(any, any, any)).thenAnswer((_) async => Future<void>.value());
when(commentsCubit.setReplyId(any)).thenReturn(null);
registerMocks(recipeCubit, commentsCubit);
await mockNetworkImagesFor(() async {
await tester.pumpWidget(
wrap(recipeCubit, feedCubit, commentsCubit, const AboutRecipeScreen(recipeSlug: 'test', index: 2, navigateToComments: true)),
);
await tester.pump();
await tester.pump(const Duration(milliseconds: 600));
});
expect(find.byType(AboutRecipeScreen), findsOneWidget);
});
});
}