-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
76% coverage for presentation/core/app_widgets.dart #255
base: development
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import 'package:collaction_app/presentation/core/app_widget.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter_bloc/flutter_bloc.dart'; | ||
import 'package:flutter_test/flutter_test.dart'; | ||
|
||
import '../services.dart'; | ||
|
||
Widget initialWidget = AppWidget(); | ||
|
||
void main() { | ||
group('Tests for AppWidget build() method', () { | ||
setUp(() { | ||
registerServices(); | ||
}); | ||
testWidgets('Testing MultiBloc Provider', (tester) async { | ||
await tester.pumpWidget(initialWidget); | ||
final multiBlocProvider = find.byType(MultiBlocProvider); | ||
expect(multiBlocProvider, findsOneWidget); | ||
}); | ||
}); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import 'package:bloc_test/bloc_test.dart'; | ||
import 'package:collaction_app/application/auth/auth_bloc.dart'; | ||
import 'package:collaction_app/application/crowdaction/subscription/subscription_bloc.dart'; | ||
import 'package:collaction_app/application/crowdaction/subscription_status/subscription_status_bloc.dart'; | ||
|
||
class MockAuthBloc extends MockBloc<AuthEvent, AuthState> implements AuthBloc {} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We could call this file There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Agreed. I saw some mocks in the test utilities file, they don't belong there. |
||
|
||
class MockSubscriptionBloc | ||
extends MockBloc<SubscriptionEvent, SubscriptionState> | ||
implements SubscriptionBloc {} | ||
|
||
class MockSubscriptionStatusBloc | ||
extends MockBloc<SubscriptionStatusEvent, SubscriptionStatusState> | ||
implements SubscriptionStatusBloc {} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import 'package:collaction_app/application/auth/auth_bloc.dart'; | ||
import 'package:collaction_app/application/crowdaction/subscription/subscription_bloc.dart'; | ||
import 'package:collaction_app/application/crowdaction/subscription_status/subscription_status_bloc.dart'; | ||
import 'package:get_it/get_it.dart'; | ||
|
||
import 'core/core_fixtures.dart'; | ||
|
||
final getIt = GetIt.instance; | ||
|
||
void registerServices() { | ||
getIt.registerSingleton<AuthBloc>(MockAuthBloc()); | ||
getIt.registerSingleton<SubscriptionBloc>(MockSubscriptionBloc()); | ||
getIt.registerSingleton<SubscriptionStatusBloc>(MockSubscriptionStatusBloc()); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible to check the
providers
values instance and validate that all the required blocs are provided