fix(authentication)!: use correct usecase and result

This commit is contained in:
2024-03-29 21:02:06 +01:00
parent 283bf80243
commit cca7b29a6d
15 changed files with 43 additions and 45 deletions
@@ -84,7 +84,7 @@ void main() {
'invokes sendEmailVerification,',
setUp: () {
when(() => authenticationRepository.sendEmailVerification())
.thenAnswer((_) async => const Ok(null));
.thenAnswer((_) async => Ok(null));
},
build: () => EmailVerificationCubit(
authenticationRepository: authenticationRepository,
@@ -100,12 +100,12 @@ void main() {
'emits success',
setUp: () {
when(() => authenticationRepository.sendEmailVerification())
.thenAnswer((_) async => const Ok(null));
.thenAnswer((_) async => Ok(null));
},
build: () => EmailVerificationCubit(
authenticationRepository: authenticationRepository,
),
seed: () => const EmailVerificationState(),
seed: EmailVerificationState.new,
act: (cubit) => cubit.sendEmailVerification(),
expect: () => [
const EmailVerificationState(
@@ -121,12 +121,12 @@ void main() {
'emits failure',
setUp: () {
when(() => authenticationRepository.sendEmailVerification())
.thenAnswer((_) async => const Err(ServerException('erreur')));
.thenAnswer((_) async => Err(const ServerException('erreur')));
},
build: () => EmailVerificationCubit(
authenticationRepository: authenticationRepository,
),
seed: () => const EmailVerificationState(),
seed: EmailVerificationState.new,
act: (cubit) => cubit.sendEmailVerification(),
expect: () => [
const EmailVerificationState(
@@ -183,7 +183,7 @@ void main() {
build: () => EmailVerificationCubit(
authenticationRepository: authenticationRepository,
),
seed: () => const EmailVerificationState(),
seed: EmailVerificationState.new,
act: (cubit) => cubit.checkEmailVerification(),
expect: () => [
const EmailVerificationState(
@@ -206,7 +206,7 @@ void main() {
build: () => EmailVerificationCubit(
authenticationRepository: authenticationRepository,
),
seed: () => const EmailVerificationState(),
seed: EmailVerificationState.new,
act: (cubit) => cubit.checkEmailVerification(),
expect: () => [
const EmailVerificationState(
@@ -222,12 +222,12 @@ void main() {
'emits failure on refresh error',
setUp: () {
when(() => authenticationRepository.refresh())
.thenAnswer((_) async => const Err(ServerException('erreur')));
.thenAnswer((_) async => Err(const ServerException('erreur')));
},
build: () => EmailVerificationCubit(
authenticationRepository: authenticationRepository,
),
seed: () => const EmailVerificationState(),
seed: EmailVerificationState.new,
act: (cubit) => cubit.checkEmailVerification(),
expect: () => [
const EmailVerificationState(