forked from eatvio/eatvio_app
feat(video_calls): ios calle mic fix, infinite loading after accepting call on an oppened app fix, incaming call declining after declining on a different device
This commit is contained in:
@@ -1027,6 +1027,42 @@ void main() {
|
||||
await reconnectController.close();
|
||||
},
|
||||
);
|
||||
|
||||
test('video-call-declined closes the call on this device', () async {
|
||||
final declined = StreamController<ChannelReadEvent>.broadcast();
|
||||
when(mockWsManager.newMessagesStream).thenReturn(null);
|
||||
when(mockWsManager.reconnected).thenAnswer((_) => const Stream.empty());
|
||||
when(
|
||||
mockWsManager.videoCallDeclinedStream,
|
||||
).thenAnswer((_) => declined.stream);
|
||||
when(mockWsManager.videoCallEndedStream).thenReturn(null);
|
||||
|
||||
final dismissed = <String?>[];
|
||||
final ended = <String?>[];
|
||||
chatsCubit.dismissIncomingVideoCall = (uuid) async {
|
||||
dismissed.add(uuid);
|
||||
};
|
||||
chatsCubit.endActiveVideoCall = ({conversationUuid, callId}) async {
|
||||
ended.add(conversationUuid);
|
||||
expect(callId, 'call-1');
|
||||
};
|
||||
|
||||
await chatsCubit.connectToWebSocket();
|
||||
declined.add(
|
||||
_FakeChannelReadEvent(
|
||||
jsonEncode(<String, dynamic>{
|
||||
'call_id': 'call-1',
|
||||
'conversation_uuid': 'conv-1',
|
||||
'status': 'declined',
|
||||
}),
|
||||
),
|
||||
);
|
||||
await Future<void>.delayed(Duration.zero);
|
||||
|
||||
expect(dismissed, ['conv-1']);
|
||||
expect(ended, ['conv-1']);
|
||||
await declined.close();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user