forked from eatvio/eatvio_app
fix(chat): ws manager
This commit is contained in:
@@ -578,6 +578,23 @@ void main() {
|
||||
expect(updatedRoom.unreadMessagesCount, 0);
|
||||
expect(updatedState.chatsWithUnreadMessagesCount, 0);
|
||||
});
|
||||
|
||||
test('connectToWebSocket - обновляет список чатов после реконнекта', () async {
|
||||
final reconnectController = StreamController<void>.broadcast();
|
||||
|
||||
when(mockWsManager.reconnected).thenAnswer((_) => reconnectController.stream);
|
||||
when(mockWsManager.newMessagesStream).thenReturn(null);
|
||||
when(mockChatRepository.getChatRooms(query: null)).thenAnswer((_) async => testChatRoomsPagination);
|
||||
|
||||
await chatsCubit.connectToWebSocket();
|
||||
|
||||
reconnectController.add(null);
|
||||
await Future.delayed(const Duration(milliseconds: 100));
|
||||
|
||||
verify(mockChatRepository.getChatRooms(query: null)).called(1);
|
||||
|
||||
await reconnectController.close();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user