Skip to content

Commit

Permalink
test(talk_app): Fix async suspensions in RoomBloc tests
Browse files Browse the repository at this point in the history
Signed-off-by: provokateurin <[email protected]>
  • Loading branch information
provokateurin committed Oct 9, 2024
1 parent 605f533 commit b7a16d0
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,7 @@ void main() {
expect(
roomBloc.room.transformResult((e) => e.token),
emitsInOrder([
Result.success('abcd'),
Result.success('abcd').asLoading(),
Result.success('abcd'),
Result.success('abcd'),
Expand Down Expand Up @@ -365,6 +366,7 @@ void main() {
expect(
roomBloc.room.transformResult((e) => e.lastMessage.chatMessage?.id),
emitsInOrder([
Result.success(null),
Result<int>.loading(),
Result.success(null),
Result.success(2),
Expand Down Expand Up @@ -697,6 +699,9 @@ void main() {
]),
);

// Wait for all events to be processed
await Future<void>.delayed(const Duration(milliseconds: 1));

final message = MockChatMessage();
when(() => message.id).thenReturn(1);
roomBloc.deleteMessage(message);
Expand Down Expand Up @@ -729,6 +734,7 @@ void main() {
expect(
roomBloc.room.transformResult((e) => e.lastMessage.chatMessage?.id),
emitsInOrder([
Result.success(null),
Result<int>.loading(),
Result.success(null),
Result.success(2),
Expand Down

0 comments on commit b7a16d0

Please sign in to comment.