feat(video_calls): repeated calls after call termination fix

This commit is contained in:
misha
2026-10-15 15:21:38 +03:00
parent 1901248539
commit 4ef174ebde
5 changed files with 74 additions and 4 deletions

View File

@@ -2,6 +2,8 @@ import 'package:eatvio_app/features/video_calls/managers/video_call_manager.dart
import 'package:eatvio_app/features/video_calls/services/video_call_foreground_coordinator.dart';
import 'package:eatvio_app/features/video_calls/services/video_call_lifecycle_binding.dart';
import 'package:eatvio_app/features/video_calls/repositories/video_call_repository.dart';
import 'dart:collection';
import 'package:flutter/widgets.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:livekit_client/livekit_client.dart' as lk;
@@ -53,6 +55,9 @@ void main() {
mockRoom = MockRoom();
when(mockRoom.connectionState).thenReturn(lk.ConnectionState.connected);
when(mockRoom.localParticipant).thenReturn(null);
when(
mockRoom.remoteParticipants,
).thenReturn(UnmodifiableMapView(<String, lk.RemoteParticipant>{}));
});
tearDown(() {

View File

@@ -66,6 +66,36 @@ void main() {
);
});
test('does not report the end while the other user is still in the room', () {
expect(
shouldNotifyCallEnded(
alreadyNotified: false,
hasConversation: true,
peerStillInRoom: true,
),
isFalse,
);
});
test('reports the end when this client is the last participant', () {
expect(
shouldNotifyCallEnded(
alreadyNotified: false,
hasConversation: true,
peerStillInRoom: false,
),
isTrue,
);
expect(
shouldNotifyCallEnded(
alreadyNotified: true,
hasConversation: true,
peerStillInRoom: false,
),
isFalse,
);
});
test('keeps a connection-loss screen when the link drops', () {
expect(
shouldForceEndCallAfterRoomDisconnect(