0

I am new to flutter unit test. I am writing a class Accounts and want to widget test.

And I am writing a test file named account_entry_page_test.dart

void main() {
  testWidgets('General section found', (tester) async {
    // await tester.pumpWidget( Provider<AuthBase>(
    //     create: (context) => Auth(),
    //     child:ChangeNotifierProvider<GeneralProvider>(
    //         create: (context) => GeneralProvider(),
    //         child:MaterialApp(home: Accounts()
    // ),),));

    await tester.pumpWidget(MaterialApp(home: Accounts()));

    final generalSection = find.text('Privacy');
    // Use the `findsOneWidget` matcher provided by flutter_test to verify
    // that the Text widgets appear exactly once in the widget tree.
    await tester.pump();
    expect(generalSection, findsOneWidget);

  });
}

But I am getting the test failed and getting following exception

The following FirebaseException was thrown building Builder:
[core/no-app] No Firebase App '[DEFAULT]' has been created - call Firebase.initializeApp()

Please let me know what wrong I am doing.

Thanks

Somdeb
  • 87
  • 1
  • 7

0 Answers0