From b7a16d043f2f36deaab714f968792750c4f5739d Mon Sep 17 00:00:00 2001 From: provokateurin Date: Wed, 9 Oct 2024 12:05:31 +0200 Subject: [PATCH] test(talk_app): Fix async suspensions in RoomBloc tests Signed-off-by: provokateurin --- .../packages/talk_app/test/room_bloc_test.dart | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/neon_framework/packages/talk_app/test/room_bloc_test.dart b/packages/neon_framework/packages/talk_app/test/room_bloc_test.dart index f9724d86b21..e1d7f0609be 100644 --- a/packages/neon_framework/packages/talk_app/test/room_bloc_test.dart +++ b/packages/neon_framework/packages/talk_app/test/room_bloc_test.dart @@ -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'), @@ -365,6 +366,7 @@ void main() { expect( roomBloc.room.transformResult((e) => e.lastMessage.chatMessage?.id), emitsInOrder([ + Result.success(null), Result.loading(), Result.success(null), Result.success(2), @@ -697,6 +699,9 @@ void main() { ]), ); + // Wait for all events to be processed + await Future.delayed(const Duration(milliseconds: 1)); + final message = MockChatMessage(); when(() => message.id).thenReturn(1); roomBloc.deleteMessage(message); @@ -729,6 +734,7 @@ void main() { expect( roomBloc.room.transformResult((e) => e.lastMessage.chatMessage?.id), emitsInOrder([ + Result.success(null), Result.loading(), Result.success(null), Result.success(2),