Skip to content

Commit

Permalink
only add error onError
Browse files Browse the repository at this point in the history
  • Loading branch information
LukasMirbt committed Jul 21, 2024
1 parent d6cec1e commit d521bdc
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,7 @@ class AuthenticationBloc
return emit(const AuthenticationState.unknown());
}
},
onError: (error, stackTrace) {
addError(error, stackTrace);
emit(const AuthenticationState.unauthenticated());
},
onError: addError,
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,17 +148,14 @@ void main() {
);

blocTest<AuthenticationBloc, AuthenticationState>(
'emits [unauthenticated] when status stream emits an error',
'adds error when status stream emits an error',
setUp: () {
when(
() => authenticationRepository.status,
).thenAnswer((_) => Stream.error(error));
},
build: buildBloc,
act: (bloc) => bloc.add(AuthenticationSubscriptionRequested()),
expect: () => const [
AuthenticationState.unauthenticated(),
],
errors: () => [error],
);
});
Expand Down

0 comments on commit d521bdc

Please sign in to comment.