From d521bdcbdfd006759307ada3f0a10a0a646ca4ca Mon Sep 17 00:00:00 2001 From: LukasMirbt Date: Sun, 21 Jul 2024 16:04:25 +0200 Subject: [PATCH] only add error onError --- .../lib/authentication/bloc/authentication_bloc.dart | 5 +---- .../test/authentication/authentication_bloc_test.dart | 5 +---- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/examples/flutter_login/lib/authentication/bloc/authentication_bloc.dart b/examples/flutter_login/lib/authentication/bloc/authentication_bloc.dart index 468afb251c3..e37ccdbbaf1 100644 --- a/examples/flutter_login/lib/authentication/bloc/authentication_bloc.dart +++ b/examples/flutter_login/lib/authentication/bloc/authentication_bloc.dart @@ -44,10 +44,7 @@ class AuthenticationBloc return emit(const AuthenticationState.unknown()); } }, - onError: (error, stackTrace) { - addError(error, stackTrace); - emit(const AuthenticationState.unauthenticated()); - }, + onError: addError, ); } diff --git a/examples/flutter_login/test/authentication/authentication_bloc_test.dart b/examples/flutter_login/test/authentication/authentication_bloc_test.dart index 868a5b80282..dbf96692b92 100644 --- a/examples/flutter_login/test/authentication/authentication_bloc_test.dart +++ b/examples/flutter_login/test/authentication/authentication_bloc_test.dart @@ -148,7 +148,7 @@ void main() { ); blocTest( - 'emits [unauthenticated] when status stream emits an error', + 'adds error when status stream emits an error', setUp: () { when( () => authenticationRepository.status, @@ -156,9 +156,6 @@ void main() { }, build: buildBloc, act: (bloc) => bloc.add(AuthenticationSubscriptionRequested()), - expect: () => const [ - AuthenticationState.unauthenticated(), - ], errors: () => [error], ); });