feat: Introduce comprehensive unit tests for models and BLoCs using mockito and bloc_test, and refine TripBloc error handling.
Some checks failed
Deploy to Play Store / build_and_deploy (push) Has been cancelled

This commit is contained in:
Van Leemput Dayron
2025-12-05 11:55:20 +01:00
parent 9b11836409
commit cac0770467
17 changed files with 1608 additions and 48 deletions

View File

@@ -31,14 +31,18 @@ import '../../services/notification_service.dart';
class AuthBloc extends Bloc<AuthEvent, AuthState> {
/// Repository for authentication operations.
final AuthRepository _authRepository;
final NotificationService _notificationService;
/// Creates an [AuthBloc] with the provided [authRepository].
///
/// The bloc starts in the [AuthInitial] state and registers event handlers
/// for all supported authentication events.
AuthBloc({required AuthRepository authRepository})
: _authRepository = authRepository,
super(AuthInitial()) {
AuthBloc({
required AuthRepository authRepository,
NotificationService? notificationService,
}) : _authRepository = authRepository,
_notificationService = notificationService ?? NotificationService(),
super(AuthInitial()) {
on<AuthCheckRequested>(_onAuthCheckRequested);
on<AuthSignInRequested>(_onSignInRequested);
on<AuthSignUpRequested>(_onSignUpRequested);
@@ -71,7 +75,7 @@ class AuthBloc extends Bloc<AuthEvent, AuthState> {
if (user != null) {
// Save FCM Token on auto-login
await NotificationService().saveTokenToFirestore(user.id!);
await _notificationService.saveTokenToFirestore(user.id!);
emit(AuthAuthenticated(user: user));
} else {
emit(AuthUnauthenticated());