forked from eatvio/eatvio_app
test(profile) Tried to make and debug the profile smoke test
This commit is contained in:
@@ -26,6 +26,7 @@ dependencies:
|
|||||||
flutter_form_builder: ^9.2.1
|
flutter_form_builder: ^9.2.1
|
||||||
image_picker: ^1.0.7
|
image_picker: ^1.0.7
|
||||||
flutter_typeahead: ^5.2.0
|
flutter_typeahead: ^5.2.0
|
||||||
|
bloc_test: ^9.1.6
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
dart_code_metrics: ^5.7.6
|
dart_code_metrics: ^5.7.6
|
||||||
|
|||||||
41
test/profile_test.dart
Normal file
41
test/profile_test.dart
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
import 'package:eatvio_app/core/app_export.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
|
import 'package:bloc_test/bloc_test.dart';
|
||||||
|
import 'package:eatvio_app/presentation/profile/my_profile_screen/my_profile_screen.dart';
|
||||||
|
import 'package:eatvio_app/presentation/profile/my_profile_screen/bloc/my_profile_bloc.dart';
|
||||||
|
import 'package:eatvio_app/presentation//profile/my_profile_screen/models/my_profile_model.dart';
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
group('MyProfileScreen', () {
|
||||||
|
testWidgets('renders CircularProgressIndicator in initial state',
|
||||||
|
(WidgetTester tester) async {
|
||||||
|
final myProfileBloc = MyProfileBloc(MyProfileState(
|
||||||
|
myProfileModelObj:
|
||||||
|
MyProfileModel())); // Ensure that MyProfileModel is non-nullable
|
||||||
|
|
||||||
|
await tester.pumpWidget(BlocProvider<MyProfileBloc>(
|
||||||
|
create: (context) => myProfileBloc,
|
||||||
|
child: MyProfileScreen(),
|
||||||
|
));
|
||||||
|
|
||||||
|
expect(find.byType(CircularProgressIndicator), findsOneWidget);
|
||||||
|
});
|
||||||
|
|
||||||
|
blocTest<MyProfileBloc, MyProfileState>(
|
||||||
|
'renders MyProfileLoadedState correctly',
|
||||||
|
build: () {
|
||||||
|
final myProfileModel = MyProfileModel(
|
||||||
|
/* передайте здесь необходимые данные */); // Create an instance of MyProfileModel
|
||||||
|
return MyProfileBloc(MyProfileState(
|
||||||
|
myProfileModelObj:
|
||||||
|
myProfileModel)); // Ensure that MyProfileModel is non-nullable
|
||||||
|
},
|
||||||
|
act: (bloc) => bloc.add(MyProfileInitialEvent()),
|
||||||
|
expect: () => [isA<MyProfileLoadedState>()],
|
||||||
|
verify: (_) {
|
||||||
|
// Add verification logic here
|
||||||
|
},
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user