Compare commits

..

No commits in common. "f05f2230e9ea15df2598a3df17b9dfd68a256c07" and "31ad460757e9b199922a4d24f20f352f2f8cf6b2" have entirely different histories.

3 changed files with 1 additions and 180 deletions

View File

@ -23,8 +23,7 @@ import 'package:wyatt_type_utils/wyatt_type_utils.dart';
class AuthenticationMockDataSourceImpl extends AuthenticationRemoteDataSource { class AuthenticationMockDataSourceImpl extends AuthenticationRemoteDataSource {
Pair<Account, String>? _connectedMock; Pair<Account, String>? _connectedMock;
Pair<Account, String>? _registeredMock; Pair<Account, String>? _registeredMock;
final StreamController<Account?> _streamAccount = StreamController() final StreamController<Account?> _streamAccount = StreamController();
..add(null);
final List<Pair<Account, String>>? registeredAccounts; final List<Pair<Account, String>>? registeredAccounts;
final String idToken; final String idToken;

View File

@ -481,178 +481,5 @@ void main() {
], ],
); );
}); });
group('update', () {
final inputsA = <
FormInput<dynamic, FormInputValidator<dynamic, ValidationError>,
dynamic>>[
FormInput(AuthFormField.email, const Email.pure()),
FormInput(AuthFormField.password, const Password.pure())
];
final inputsB = <
FormInput<dynamic, FormInputValidator<dynamic, ValidationError>,
dynamic>>[
FormInput('name', const Name.pure()),
FormInput('phone', const Phone.pure()),
];
final inputsC = <
FormInput<dynamic, FormInputValidator<dynamic, ValidationError>,
dynamic>>[
FormInput(AuthFormField.email, const Email.pure()),
FormInput(AuthFormField.password, const Password.pure()),
FormInput('name', const Name.pure()),
FormInput('phone', const Phone.pure()),
];
blocTest<SignUpCubit<int>, SignUpState>(
'emits no state when apply intersection with the same form',
build: () => SignUpCubit(
authenticationRepository: authenticationRepository,
),
seed: () => SignUpState(
form: WyattFormImpl(
inputsA,
name: AuthFormName.signUpForm,
),
),
act: (cubit) => cubit.update(
WyattFormImpl(inputsA, name: 'otherSignUpForm'),
operation: SetOperation.intersection,
),
expect: () => <SignUpState>[],
);
blocTest<SignUpCubit<int>, SignUpState>(
'emits no state when apply intersection with a form that '
'contains every inputs of actual form',
build: () => SignUpCubit(
authenticationRepository: authenticationRepository,
),
seed: () => SignUpState(
form: WyattFormImpl(
inputsA,
name: AuthFormName.signUpForm,
),
),
act: (cubit) => cubit.update(
WyattFormImpl(inputsC, name: 'otherSignUpForm'),
operation: SetOperation.intersection,
),
expect: () => <SignUpState>[],
);
blocTest<SignUpCubit<int>, SignUpState>(
'emits the form intersection when apply '
'intersection with a smaller form',
build: () => SignUpCubit(
authenticationRepository: authenticationRepository,
),
seed: () => SignUpState(
form: WyattFormImpl(
inputsC,
name: AuthFormName.signUpForm,
),
),
act: (cubit) => cubit.update(
WyattFormImpl(inputsA, name: 'otherSignUpForm'),
operation: SetOperation.intersection,
),
expect: () => <SignUpState>[
SignUpState(
form: WyattFormImpl(
inputsA,
name: AuthFormName.signUpForm,
),
),
],
);
blocTest<SignUpCubit<int>, SignUpState>(
'emits no state when apply union with the same form',
build: () => SignUpCubit(
authenticationRepository: authenticationRepository,
),
seed: () => SignUpState(
form: WyattFormImpl(
inputsA,
name: AuthFormName.signUpForm,
),
),
act: (cubit) => cubit.update(
WyattFormImpl(inputsA, name: 'otherSignUpForm'),
operation: SetOperation.union,
),
expect: () => <SignUpState>[],
);
blocTest<SignUpCubit<int>, SignUpState>(
'emits the form union when apply '
'union with an another form',
build: () => SignUpCubit(
authenticationRepository: authenticationRepository,
),
seed: () => SignUpState(
form: WyattFormImpl(
inputsA,
name: AuthFormName.signUpForm,
),
),
act: (cubit) => cubit.update(
WyattFormImpl(inputsB, name: 'otherSignUpForm'),
operation: SetOperation.union,
),
expect: () => <SignUpState>[
SignUpState(
form: WyattFormImpl(
inputsC,
name: AuthFormName.signUpForm,
),
),
],
);
blocTest<SignUpCubit<int>, SignUpState>(
'emits no state when apply replace with the same form',
build: () => SignUpCubit(
authenticationRepository: authenticationRepository,
),
seed: () => SignUpState(
form: WyattFormImpl(
inputsA,
name: AuthFormName.signUpForm,
),
),
act: (cubit) => cubit.update(
WyattFormImpl(inputsA, name: AuthFormName.signUpForm),
),
expect: () => <SignUpState>[],
);
blocTest<SignUpCubit<int>, SignUpState>(
'emits a state with a new form after the replacement',
build: () => SignUpCubit(
authenticationRepository: authenticationRepository,
),
seed: () => SignUpState(
form: WyattFormImpl(
inputsA,
name: AuthFormName.signUpForm,
),
),
act: (cubit) => cubit.update(
WyattFormImpl(inputsC, name: AuthFormName.signUpForm),
),
expect: () => <SignUpState>[
SignUpState(
form: WyattFormImpl(
inputsC,
name: AuthFormName.signUpForm,
),
),
],
);
});
}); });
} }

View File

@ -59,11 +59,6 @@ void main() {
final result = const FormReplace().call(formA, formB); final result = const FormReplace().call(formA, formB);
expect(result, formB); expect(result, formB);
}); });
test('returns A when called on (A,A)', () {
final result = const FormReplace().call(formA, formA);
expect(result, formA);
});
}); });
group('FormUnion', () { group('FormUnion', () {