forked from eatvio/eatvio_app
feat(tests): test coverage is 70.5
This commit is contained in:
@@ -66,5 +66,22 @@ void main() {
|
||||
expect(find.byType(MyRecipesScreen), findsOneWidget);
|
||||
expect(find.text('Мои рецепты'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('renders my recipes screen with error state', (tester) async {
|
||||
final cubit = MockMyRecipesCubit();
|
||||
const state = MyRecipesStateError();
|
||||
|
||||
when(cubit.state).thenReturn(state);
|
||||
when(cubit.stream).thenAnswer((_) => Stream.value(state));
|
||||
when(cubit.close()).thenAnswer((_) async => Future<void>.value());
|
||||
when(cubit.getMyRecipes()).thenAnswer((_) async => Future<void>.value());
|
||||
|
||||
sl.registerFactory<MyRecipesCubit>(() => cubit);
|
||||
|
||||
await tester.pumpWidget(wrap(const MyRecipesScreen()));
|
||||
await tester.pump();
|
||||
|
||||
expect(find.byType(MyRecipesScreen), findsOneWidget);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user