Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
feat(bloc_test): FakeAsync support - fire all asynchronous events wit…
…hout actually needing to wait for real time to elapse

1. Fixed formatting in bloc_test
  • Loading branch information
PankovSerge committed May 27, 2023
commit 4ee0f866e2bc99964613508aa2b14a76cc26251f
19 changes: 15 additions & 4 deletions packages/bloc_test/lib/src/bloc_test.dart
Original file line number Diff line number Diff line change
@@ -470,7 +470,11 @@ void testBlocFakeAsync<B extends BlocBase<State>, State>({
(Object error, _) {
try {
_validateBlocErrors(
errors, error, unhandledErrors, shallowEquality);
errors,
error,
unhandledErrors,
shallowEquality,
);
} catch (_) {
errorThrown = true;
rethrow;
@@ -482,8 +486,12 @@ void testBlocFakeAsync<B extends BlocBase<State>, State>({
}
}

void _validateBlocErrors(dynamic Function()? errors, Object error,
List<Object> unhandledErrors, bool shallowEquality) {
void _validateBlocErrors(
dynamic Function()? errors,
Object error,
List<Object> unhandledErrors,
bool shallowEquality,
) {
if (shallowEquality && error is test.TestFailure) {
// ignore: only_throw_errors
throw test.TestFailure(
@@ -499,7 +507,10 @@ Alternatively, consider using Matchers in the expect of the blocTest rather than
}

void _validateBlocExpect<State>(
dynamic expected, List<State> states, bool shallowEquality) {
dynamic expected,
List<State> states,
bool shallowEquality,
) {
try {
test.expect(states, test.wrapMatcher(expected));
} on test.TestFailure catch (e) {