test(authentication): fix tests
This commit is contained in:
@@ -579,11 +579,11 @@ void main() {
|
||||
[
|
||||
FormInput(
|
||||
AuthFormField.email,
|
||||
const Email.dirty(validEmailString),
|
||||
const Email.pure(),
|
||||
),
|
||||
FormInput(
|
||||
AuthFormField.password,
|
||||
const Password.dirty(validPasswordString),
|
||||
const Password.pure(),
|
||||
)
|
||||
],
|
||||
name: AuthFormName.signInForm,
|
||||
@@ -595,11 +595,11 @@ void main() {
|
||||
[
|
||||
FormInput(
|
||||
AuthFormField.email,
|
||||
const Email.dirty(validEmailString),
|
||||
const Email.pure(),
|
||||
),
|
||||
FormInput(
|
||||
AuthFormField.password,
|
||||
const Password.dirty(validPasswordString),
|
||||
const Password.pure(),
|
||||
)
|
||||
],
|
||||
name: AuthFormName.signInForm,
|
||||
@@ -643,11 +643,11 @@ void main() {
|
||||
[
|
||||
FormInput(
|
||||
AuthFormField.email,
|
||||
const Email.dirty(validEmailString),
|
||||
const Email.pure(),
|
||||
),
|
||||
FormInput(
|
||||
AuthFormField.password,
|
||||
const Password.dirty(validPasswordString),
|
||||
const Password.pure(),
|
||||
)
|
||||
],
|
||||
name: AuthFormName.signInForm,
|
||||
@@ -659,11 +659,11 @@ void main() {
|
||||
[
|
||||
FormInput(
|
||||
AuthFormField.email,
|
||||
const Email.dirty(validEmailString),
|
||||
const Email.pure(),
|
||||
),
|
||||
FormInput(
|
||||
AuthFormField.password,
|
||||
const Password.dirty(validPasswordString),
|
||||
const Password.pure(),
|
||||
)
|
||||
],
|
||||
name: AuthFormName.signInForm,
|
||||
|
||||
@@ -65,6 +65,13 @@ void main() {
|
||||
),
|
||||
).thenAnswer((_) async => Ok(account));
|
||||
|
||||
when(
|
||||
() => authenticationRepository.signInWithEmailAndPassword(
|
||||
email: any(named: 'email'),
|
||||
password: any(named: 'password'),
|
||||
),
|
||||
).thenAnswer((_) async => Ok(account));
|
||||
|
||||
when(
|
||||
() => authenticationRepository.formRepository,
|
||||
).thenAnswer((_) => formRepository);
|
||||
@@ -258,13 +265,13 @@ void main() {
|
||||
);
|
||||
});
|
||||
|
||||
group('submit', () {
|
||||
group('signUpWithEmailPassword', () {
|
||||
blocTest<SignUpCubit<int>, SignUpState>(
|
||||
'does nothing when status is not validated',
|
||||
build: () => SignUpCubit(
|
||||
authenticationRepository: authenticationRepository,
|
||||
),
|
||||
act: (cubit) => cubit.submit(),
|
||||
act: (cubit) => cubit.signUpWithEmailPassword(),
|
||||
expect: () => const <SignUpState>[],
|
||||
);
|
||||
|
||||
@@ -308,7 +315,7 @@ void main() {
|
||||
),
|
||||
status: FormStatus.valid,
|
||||
),
|
||||
act: (cubit) => cubit.submit(),
|
||||
act: (cubit) => cubit.signUpWithEmailPassword(),
|
||||
verify: (_) {
|
||||
verify(
|
||||
() => authenticationRepository.signUp(
|
||||
@@ -360,7 +367,7 @@ void main() {
|
||||
),
|
||||
status: FormStatus.valid,
|
||||
),
|
||||
act: (cubit) => cubit.submit(),
|
||||
act: (cubit) => cubit.signUpWithEmailPassword(),
|
||||
expect: () => <SignUpState>[
|
||||
SignUpState(
|
||||
form: WyattFormImpl(
|
||||
@@ -444,7 +451,7 @@ void main() {
|
||||
),
|
||||
status: FormStatus.valid,
|
||||
),
|
||||
act: (cubit) => cubit.submit(),
|
||||
act: (cubit) => cubit.signUpWithEmailPassword(),
|
||||
expect: () => <SignUpState>[
|
||||
SignUpState(
|
||||
form: WyattFormImpl(
|
||||
|
||||
Reference in New Issue
Block a user