Created
March 23, 2020 23:26
-
-
Save jonahwilliams/630c682fd5627386daf5b33dfba3fb7f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:covidnearme/src/blocs/checkup/checkup.dart'; | |
import 'package:covidnearme/src/blocs/preferences/preferences.dart'; | |
import 'package:covidnearme/src/blocs/questions/questions_bloc.dart'; | |
import 'package:covidnearme/src/data/repositories/questions.dart'; | |
import 'package:covidnearme/src/ui/screens/checkup/checkup.dart'; | |
import 'package:file/memory.dart'; | |
import 'package:flutter/material.dart'; | |
import 'package:flutter/widgets.dart'; | |
import 'package:flutter_bloc/flutter_bloc.dart'; | |
import 'package:flutter_test/flutter_test.dart'; | |
import 'package:hydrated_bloc/hydrated_bloc.dart'; | |
void main() { | |
setUp(() async { | |
// Use a hermetic file system that is cleaned up between tests. | |
final fs = MemoryFileSystem.test(); | |
BlocSupervisor.delegate = await HydratedBlocDelegate.build( | |
storageDirectory: fs.systemTempDirectory.createTempSync(), | |
); | |
}); | |
testWidgets('description', (tester) async { | |
final questions = QuestionsBloc(questionsRepository: QuestionsRepository()); | |
final checkup = CheckupBloc(); | |
final preferences = PreferencesBloc(); | |
await tester.pumpWidget(setUpProviders( | |
questions, | |
checkup, | |
preferences, | |
)); | |
}); | |
} | |
Widget setUpProviders( | |
QuestionsBloc questionsBloc, | |
CheckupBloc checkupBloc, | |
PreferencesBloc preferences, | |
) { | |
return MaterialApp( | |
home: Scaffold( | |
body: BlocProvider( | |
child: BlocProvider( | |
child: BlocProvider( | |
child: CheckupScreen(), | |
create: (BuildContext context) => preferences, | |
), | |
create: (BuildContext context) => checkupBloc, | |
), | |
create: (BuildContext context) => questionsBloc, | |
), | |
), | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment