Skip to content

Commit

Permalink
adjust tests
Browse files Browse the repository at this point in the history
  • Loading branch information
felangel committed Oct 27, 2023
1 parent c8379cd commit 99b884f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
7 changes: 2 additions & 5 deletions packages/bloc_test/test/bloc_bloc_test_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -102,13 +102,10 @@ void main() {
);

blocTest<CounterBloc, int>(
'expect is async',
'emits [1] when CounterEvent.increment is added and expect is async',
build: () => CounterBloc(),
act: (bloc) => bloc.add(CounterEvent.increment),
expect: () async {
await Future<void>.delayed(Duration.zero);
return const <int>[1];
},
expect: () async => <int>[1],
);

test('fails immediately when expectation is incorrect', () async {
Expand Down
7 changes: 7 additions & 0 deletions packages/bloc_test/test/cubit_bloc_test_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,13 @@ void main() {
act: (cubit) => cubit.increment(),
expect: () => <int>[3],
);

blocTest<CounterCubit, int>(
'emits [1] when increment is called and expect is async',
build: () => CounterCubit(),
act: (cubit) => cubit.increment(),
expect: () async => <int>[1],
);
});

group('AsyncCounterCubit', () {
Expand Down

0 comments on commit 99b884f

Please sign in to comment.