forked from eatvio/eatvio_app
Merge remote-tracking branch 'upstream/main'
This commit is contained in:
@@ -2,6 +2,8 @@ import 'package:eatvio_app/core/app_config.dart';
|
||||
import 'package:eatvio_app/core/app_initializer.dart';
|
||||
import 'package:eatvio_app/core/locator_service.dart';
|
||||
import 'package:eatvio_app/core/theme/theme_helper.dart';
|
||||
import 'package:eatvio_app/features/bottom_navigation_bar/presentation/bloc/profile_avatar_cubit/profile_avatar_cubit.dart';
|
||||
import 'package:eatvio_app/features/bottom_navigation_bar/presentation/bloc/profile_avatar_cubit/profile_avatar_state.dart';
|
||||
import 'package:eatvio_app/features/bottom_navigation_bar/presentation/widgets/bottom_navigation_bar_widget.dart';
|
||||
import 'package:eatvio_app/features/chat/presentation/bloc/chats_cubit/chats_cubit.dart';
|
||||
import 'package:eatvio_app/features/chat/presentation/bloc/chats_cubit/chats_state.dart';
|
||||
@@ -20,7 +22,7 @@ import 'package:network_image_mock/network_image_mock.dart';
|
||||
|
||||
import 'bottom_navigation_bar_widget_test.mocks.dart';
|
||||
|
||||
@GenerateNiceMocks([MockSpec<NotificationsCubit>(), MockSpec<ChatsCubit>()])
|
||||
@GenerateNiceMocks([MockSpec<NotificationsCubit>(), MockSpec<ChatsCubit>(), MockSpec<ProfileAvatarCubit>()])
|
||||
void main() {
|
||||
group('BottomNavigationBarWidget smoke', () {
|
||||
setUpAll(() async {
|
||||
@@ -86,6 +88,7 @@ void main() {
|
||||
mockNetworkImagesFor(() async {
|
||||
final notificationsCubit = MockNotificationsCubit();
|
||||
final chatsCubit = MockChatsCubit();
|
||||
final profileAvatarCubit = MockProfileAvatarCubit();
|
||||
|
||||
when(notificationsCubit.state).thenReturn(const NotificationsState());
|
||||
when(notificationsCubit.stream).thenAnswer((_) => const Stream.empty());
|
||||
@@ -93,16 +96,20 @@ void main() {
|
||||
when(chatsCubit.state).thenReturn(ChatsState());
|
||||
when(chatsCubit.stream).thenAnswer((_) => const Stream.empty());
|
||||
when(chatsCubit.close()).thenAnswer((_) async => Future<void>.value());
|
||||
when(profileAvatarCubit.state).thenReturn(const ProfileAvatarState.loaded(profile: mockUserProfile));
|
||||
when(profileAvatarCubit.stream).thenAnswer((_) => const Stream.empty());
|
||||
when(profileAvatarCubit.close()).thenAnswer((_) async => Future<void>.value());
|
||||
|
||||
await tester.pumpWidget(
|
||||
MultiBlocProvider(
|
||||
providers: [
|
||||
BlocProvider<NotificationsCubit>.value(value: notificationsCubit),
|
||||
BlocProvider<ChatsCubit>.value(value: chatsCubit),
|
||||
BlocProvider<ProfileAvatarCubit>.value(value: profileAvatarCubit),
|
||||
],
|
||||
child: wrap(
|
||||
const Scaffold(
|
||||
body: BottomNavigationBarWidget(profileModel: mockUserProfile, child: Text('Test Content')),
|
||||
body: BottomNavigationBarWidget(child: Text('Test Content')),
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -117,6 +124,7 @@ void main() {
|
||||
mockNetworkImagesFor(() async {
|
||||
final notificationsCubit = MockNotificationsCubit();
|
||||
final chatsCubit = MockChatsCubit();
|
||||
final profileAvatarCubit = MockProfileAvatarCubit();
|
||||
|
||||
when(notificationsCubit.state).thenReturn(const NotificationsState());
|
||||
when(notificationsCubit.stream).thenAnswer((_) => const Stream.empty());
|
||||
@@ -124,16 +132,20 @@ void main() {
|
||||
when(chatsCubit.state).thenReturn(ChatsState());
|
||||
when(chatsCubit.stream).thenAnswer((_) => const Stream.empty());
|
||||
when(chatsCubit.close()).thenAnswer((_) async => Future<void>.value());
|
||||
when(profileAvatarCubit.state).thenReturn(const ProfileAvatarState.loaded(profile: mockConsultantProfile));
|
||||
when(profileAvatarCubit.stream).thenAnswer((_) => const Stream.empty());
|
||||
when(profileAvatarCubit.close()).thenAnswer((_) async => Future<void>.value());
|
||||
|
||||
await tester.pumpWidget(
|
||||
MultiBlocProvider(
|
||||
providers: [
|
||||
BlocProvider<NotificationsCubit>.value(value: notificationsCubit),
|
||||
BlocProvider<ChatsCubit>.value(value: chatsCubit),
|
||||
BlocProvider<ProfileAvatarCubit>.value(value: profileAvatarCubit),
|
||||
],
|
||||
child: wrap(
|
||||
const Scaffold(
|
||||
body: BottomNavigationBarWidget(profileModel: mockConsultantProfile, child: Text('Test Content')),
|
||||
body: BottomNavigationBarWidget(child: Text('Test Content')),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -34,6 +34,7 @@ void main() {
|
||||
),
|
||||
),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.byType(ChosenDietWidgetContent), findsOneWidget);
|
||||
expect(find.text('Test Diet'), findsOneWidget);
|
||||
@@ -50,6 +51,7 @@ void main() {
|
||||
),
|
||||
),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.byType(ChosenDietWidgetContent), findsOneWidget);
|
||||
});
|
||||
@@ -65,6 +67,7 @@ void main() {
|
||||
),
|
||||
),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.text('My Diet'), findsOneWidget);
|
||||
});
|
||||
|
||||
@@ -37,6 +37,7 @@ void main() {
|
||||
planName: 'Test Plan',
|
||||
planDuration: 14,
|
||||
));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.byType(ChosenPlanWidgetContent), findsOneWidget);
|
||||
expect(find.text('Test Plan'), findsOneWidget);
|
||||
@@ -48,6 +49,7 @@ void main() {
|
||||
planName: 'My Plan',
|
||||
planDuration: 7,
|
||||
));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.byType(ChosenPlanWidgetContent), findsOneWidget);
|
||||
expect(find.textContaining('3'), findsOneWidget);
|
||||
@@ -60,6 +62,7 @@ void main() {
|
||||
planName: 'Long Plan',
|
||||
planDuration: 30,
|
||||
));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.byType(ChosenPlanWidgetContent), findsOneWidget);
|
||||
expect(find.text('Long Plan'), findsOneWidget);
|
||||
|
||||
@@ -78,6 +78,7 @@ void main() {
|
||||
),
|
||||
),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.byType(CommentsWidget), findsOneWidget);
|
||||
});
|
||||
|
||||
@@ -63,6 +63,7 @@ void main() {
|
||||
|
||||
// Act
|
||||
await tester.pumpWidget(createTestWidget(const SizedBox(), mockCubit));
|
||||
await tester.pump();
|
||||
await tester.tap(find.text('Show Bottom Sheet'));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
@@ -107,6 +108,7 @@ void main() {
|
||||
|
||||
// Act
|
||||
await tester.pumpWidget(createTestWidgetError(const SizedBox(), mockCubit));
|
||||
await tester.pump();
|
||||
await tester.tap(find.text('Show Bottom Sheet'));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
|
||||
@@ -54,6 +54,7 @@ void main() {
|
||||
home: ChangePasswordScreen(settingsEntity: settingsEntity),
|
||||
),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.byType(ChangePasswordScreen), findsOneWidget);
|
||||
expect(find.text('Смена пароля'), findsOneWidget);
|
||||
@@ -80,6 +81,7 @@ void main() {
|
||||
home: ChangePasswordScreen(settingsEntity: settingsEntity),
|
||||
),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.byType(AppBar), findsOneWidget);
|
||||
expect(find.text('Смена пароля'), findsOneWidget);
|
||||
|
||||
Reference in New Issue
Block a user