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

@@ -0,0 +1,198 @@
// Mocks generated by Mockito 5.4.6 from annotations
// in travel_mate/test/blocs/auth_bloc_test.dart.
// Do not manually edit this file.
// ignore_for_file: no_leading_underscores_for_library_prefixes
import 'dart:async' as _i3;
import 'package:firebase_auth/firebase_auth.dart' as _i4;
import 'package:mockito/mockito.dart' as _i1;
import 'package:travel_mate/models/user.dart' as _i5;
import 'package:travel_mate/repositories/auth_repository.dart' as _i2;
import 'package:travel_mate/services/notification_service.dart' as _i6;
// ignore_for_file: type=lint
// ignore_for_file: avoid_redundant_argument_values
// ignore_for_file: avoid_setters_without_getters
// ignore_for_file: comment_references
// ignore_for_file: deprecated_member_use
// ignore_for_file: deprecated_member_use_from_same_package
// ignore_for_file: implementation_imports
// ignore_for_file: invalid_use_of_visible_for_testing_member
// ignore_for_file: must_be_immutable
// ignore_for_file: prefer_const_constructors
// ignore_for_file: unnecessary_parenthesis
// ignore_for_file: camel_case_types
// ignore_for_file: subtype_of_sealed_class
/// A class which mocks [AuthRepository].
///
/// See the documentation for Mockito's code generation for more information.
class MockAuthRepository extends _i1.Mock implements _i2.AuthRepository {
MockAuthRepository() {
_i1.throwOnMissingStub(this);
}
@override
_i3.Stream<_i4.User?> get authStateChanges =>
(super.noSuchMethod(
Invocation.getter(#authStateChanges),
returnValue: _i3.Stream<_i4.User?>.empty(),
)
as _i3.Stream<_i4.User?>);
@override
_i3.Future<_i5.User?> signInWithEmailAndPassword({
required String? email,
required String? password,
}) =>
(super.noSuchMethod(
Invocation.method(#signInWithEmailAndPassword, [], {
#email: email,
#password: password,
}),
returnValue: _i3.Future<_i5.User?>.value(),
)
as _i3.Future<_i5.User?>);
@override
_i3.Future<_i5.User?> signUpWithEmailAndPassword({
required String? email,
required String? password,
required String? nom,
required String? prenom,
required String? phoneNumber,
}) =>
(super.noSuchMethod(
Invocation.method(#signUpWithEmailAndPassword, [], {
#email: email,
#password: password,
#nom: nom,
#prenom: prenom,
#phoneNumber: phoneNumber,
}),
returnValue: _i3.Future<_i5.User?>.value(),
)
as _i3.Future<_i5.User?>);
@override
_i3.Future<_i5.User?> signUpWithGoogle(
String? phoneNumber,
String? name,
String? firstname,
) =>
(super.noSuchMethod(
Invocation.method(#signUpWithGoogle, [
phoneNumber,
name,
firstname,
]),
returnValue: _i3.Future<_i5.User?>.value(),
)
as _i3.Future<_i5.User?>);
@override
_i3.Future<_i5.User?> signInWithGoogle() =>
(super.noSuchMethod(
Invocation.method(#signInWithGoogle, []),
returnValue: _i3.Future<_i5.User?>.value(),
)
as _i3.Future<_i5.User?>);
@override
_i3.Future<_i5.User?> signUpWithApple(
String? phoneNumber,
String? name,
String? firstname,
) =>
(super.noSuchMethod(
Invocation.method(#signUpWithApple, [phoneNumber, name, firstname]),
returnValue: _i3.Future<_i5.User?>.value(),
)
as _i3.Future<_i5.User?>);
@override
_i3.Future<_i5.User?> signInWithApple() =>
(super.noSuchMethod(
Invocation.method(#signInWithApple, []),
returnValue: _i3.Future<_i5.User?>.value(),
)
as _i3.Future<_i5.User?>);
@override
_i3.Future<void> signOut() =>
(super.noSuchMethod(
Invocation.method(#signOut, []),
returnValue: _i3.Future<void>.value(),
returnValueForMissingStub: _i3.Future<void>.value(),
)
as _i3.Future<void>);
@override
_i3.Future<void> resetPassword(String? email) =>
(super.noSuchMethod(
Invocation.method(#resetPassword, [email]),
returnValue: _i3.Future<void>.value(),
returnValueForMissingStub: _i3.Future<void>.value(),
)
as _i3.Future<void>);
@override
_i3.Future<_i5.User?> getUserFromFirestore(String? uid) =>
(super.noSuchMethod(
Invocation.method(#getUserFromFirestore, [uid]),
returnValue: _i3.Future<_i5.User?>.value(),
)
as _i3.Future<_i5.User?>);
}
/// A class which mocks [NotificationService].
///
/// See the documentation for Mockito's code generation for more information.
class MockNotificationService extends _i1.Mock
implements _i6.NotificationService {
MockNotificationService() {
_i1.throwOnMissingStub(this);
}
@override
_i3.Future<void> initialize() =>
(super.noSuchMethod(
Invocation.method(#initialize, []),
returnValue: _i3.Future<void>.value(),
returnValueForMissingStub: _i3.Future<void>.value(),
)
as _i3.Future<void>);
@override
void startListening() => super.noSuchMethod(
Invocation.method(#startListening, []),
returnValueForMissingStub: null,
);
@override
_i3.Future<void> handleInitialMessage() =>
(super.noSuchMethod(
Invocation.method(#handleInitialMessage, []),
returnValue: _i3.Future<void>.value(),
returnValueForMissingStub: _i3.Future<void>.value(),
)
as _i3.Future<void>);
@override
_i3.Future<String?> getFCMToken() =>
(super.noSuchMethod(
Invocation.method(#getFCMToken, []),
returnValue: _i3.Future<String?>.value(),
)
as _i3.Future<String?>);
@override
_i3.Future<void> saveTokenToFirestore(String? userId) =>
(super.noSuchMethod(
Invocation.method(#saveTokenToFirestore, [userId]),
returnValue: _i3.Future<void>.value(),
returnValueForMissingStub: _i3.Future<void>.value(),
)
as _i3.Future<void>);
}