feat(video_calls): call ended push, recall button for message

This commit is contained in:
misha
2026-06-30 16:11:18 +03:00
parent c0c7e2e658
commit f493e07f9f
30 changed files with 671 additions and 83 deletions

View File

@@ -1,3 +1,4 @@
import 'package:eatvio_app/features/video_calls/services/video_call_ended_push_payload.dart';
import 'package:eatvio_app/features/video_calls/services/video_call_push_payload.dart';
import 'package:flutter_test/flutter_test.dart';
@@ -40,14 +41,21 @@ void main() {
expect(payload.counterpartName, 'Ivan');
});
test('ignores ended video call push', () {
expect(
VideoCallPushPayload.tryParse({
'type': 'video_call_ended',
'conversation_uuid': 'abc-123',
}),
isNull,
);
test('parses ended video call push with type only', () {
final payload = VideoCallEndedPushPayload.tryParse({
'type': 'video_call_ended',
});
expect(payload, isNotNull);
});
test('parses ended video call push with optional conversation uuid', () {
final payload = VideoCallEndedPushPayload.tryParse({
'type': 'video_call_ended',
'conversation_uuid': 'abc-123',
});
expect(payload, isNotNull);
});
test('ignores regular chat push', () {

View File

@@ -90,5 +90,25 @@ void main() {
throwsA(isA<Exception>()),
);
});
test('notifyCallAccepted - отправляет hw_id и получает ответ', () async {
const conversationUuid = 'conv-uuid-123';
const body = <String, dynamic>{'hw_id': 'device-android-001'};
final json = FixtureReader.readAsMap('video_calls/video_call_accept_response.json');
final expected = VideoCallAcceptResponse.fromJson(json);
when(mockService.notifyCallAccepted(conversationUuid: conversationUuid, body: body))
.thenAnswer((_) async => expected);
final result = await mockService.notifyCallAccepted(
conversationUuid: conversationUuid,
body: body,
);
expect(result, isA<VideoCallAcceptResponse>());
expect(result.sent, isTrue);
expect(result.devicesNotified, 2);
verify(mockService.notifyCallAccepted(conversationUuid: conversationUuid, body: body)).called(1);
});
});
}