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

Nullable and error report in useCase #13

Open
pro100svitlo opened this issue Nov 25, 2021 · 1 comment
Open

Nullable and error report in useCase #13

pro100svitlo opened this issue Nov 25, 2021 · 1 comment

Comments

@pro100svitlo
Copy link
Contributor

So i found 2 bugs in the use_case related section, both related to the nullable values:

№1

_appThemeHandler = consume(_listenAppThemeUseCase, initialData: none);

consume method receive optional but nullable param initialData.
the problem comes, when useCase input is not nullable.

№2

  useCaseTest<ListenAppThemeUseCase, void, AppTheme>(
    'WHEN storage emit new value THEN useCase emit it as well',
    build: () => useCase,
    setUp: () {
      controller.add(AppTheme.dark);
      controller.close();
    },
    input: [null],
    expect: [useCaseSuccess(AppTheme.dark)],
  );

same thing here, but even worse a bit.
input can receive a list of values. it might be null (as in the example), but the useCase does not accept nullable values.
So in the current setup error will be swallowed by some internal try/catch (probably line 92, use_case_test.dart) and never returned,
The test continues to execute (transaction never called properly cos of the null value) and as result - timeout exception comes

@frankpepermans
Copy link
Contributor

The try catch should be removed in the other PR,

For initialdata, will check

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants