test(profile) Profile test passed

This commit is contained in:
2024-03-12 15:16:37 +03:00
parent d0adebaa35
commit d23716c35b

View File

@@ -1,10 +1,9 @@
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';
import 'package:eatvio_app/presentation/profile/my_profile_screen/models/my_profile_model.dart';
void main() {
group('MyProfileScreen', () {
@@ -14,28 +13,14 @@ void main() {
myProfileModelObj:
MyProfileModel())); // Ensure that MyProfileModel is non-nullable
await tester.pumpWidget(BlocProvider<MyProfileBloc>(
create: (context) => myProfileBloc,
child: MyProfileScreen(),
));
expect(find.byType(CircularProgressIndicator), findsOneWidget);
await tester.pumpWidget(
MaterialApp(
home: BlocProvider<MyProfileBloc>.value(
value: myProfileBloc,
child: MyProfileScreen(),
),
),
);
});
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
},
);
});
}