Skip to content
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

[RF] Tests for error handling feature removed #53

Open
nickmeinhold opened this issue Feb 8, 2022 · 0 comments
Open

[RF] Tests for error handling feature removed #53

nickmeinhold opened this issue Feb 8, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@nickmeinhold
Copy link
Collaborator

Fix removed tests

Possibly we just need to use a Store that does pass on actions... seems like the problem is maybe the ‘backend’ of redux not being wired up?

I followed the path of the error for the first test and I think it fails because the AddProblemAction dispatched in middleware when the service throws is never recieved by the relevant reducer

(removed from packages/redfire/test/error-handling/unit-tests/widgets/add_problem_page_widget_test.dart)

testWidgets('problem page appears after error caught',
        (WidgetTester tester) async {
  // The default services harness has mocked out plugins.
  // One of the initial actions attempts to listen to auth state changes
  // which throws in this context as the MockFirebaseAuth has no stub set.
  final harness = AppWidgetHarness.withMockedPlugins(
      ExampleAppState.init(), ServicesHarness());

  await tester.pumpWidget(harness.widget);
  await tester.pump();

  expect(find.byType(ProblemPageView), findsOneWidget);
});

Same kind of probem I think:

Removed from packages/redfire/test/error-handling/unit-tests/widgets/dismiss_problem_widget_test.dart

final problem = ProblemInfo('Problem error message');

testWidgets(
    'is removed from widget tree when ProblemPageData is removed from Store',
    (WidgetTester tester) async {
  final problemPageData = ProblemPageData(problem);
  final state = ExampleAppState.init();
  final updatedState =
      state.copyWith(pages: state.pages.add(problemPageData));
  final store = FakeStore(updatedState);
  final appWidget =
      AppWidgetHarness.withStore(initializedStore: store).widget;

  await tester.pumpWidget(appWidget);
  await tester.pump();

  expect(find.byType(ProblemPageView), findsOneWidget);

  store.updateState(store.state
      .copyWith(pages: store.state.pages.remove(problemPageData)));
  store.updateState(store.state);

  await tester.pumpAndSettle();

  expect(find.byType(ProblemPage), findsNothing);
});

Maybe look at redfire_test and see if there is a different harness that has more of the backend wired up? Maybe we need to add the relevant reducers?

@nickmeinhold nickmeinhold added the bug Something isn't working label Feb 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant