Skip to content

Commit 3ee90ce

Browse files
authored
fix(test): stub getSenders/getReceivers in renegotiation handler tests (#1226)
RenegotiationHandler.handle now calls getSenders() and getReceivers() before createOffer to determine anyoneHasVideo, but the affected tests did not stub these methods — causing a TypeError that short-circuited execution before the verify assertions could pass.
1 parent 65d86c8 commit 3ee90ce

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

test/features/call/utils/renegotiation_handler_test.dart

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ void main() {
7373
// native "stable", so null must be treated as stable to allow the
7474
// first offer after restoration.
7575
when(() => mockPC.signalingState).thenReturn(null);
76+
when(() => mockPC.getSenders()).thenAnswer((_) async => []);
77+
when(() => mockPC.getReceivers()).thenAnswer((_) async => []);
7678
when(() => mockPC.createOffer(any())).thenAnswer((_) async => kOffer);
7779
when(() => mockPC.setLocalDescription(any())).thenAnswer((_) async {});
7880

@@ -110,6 +112,8 @@ void main() {
110112
when(
111113
() => mockPC.signalingState,
112114
).thenAnswer((_) => callCount++ == 0 ? RTCSignalingState.RTCSignalingStateStable : null);
115+
when(() => mockPC.getSenders()).thenAnswer((_) async => []);
116+
when(() => mockPC.getReceivers()).thenAnswer((_) async => []);
113117
when(() => mockPC.createOffer(any())).thenAnswer((_) async => kOffer);
114118
when(() => mockPC.setLocalDescription(any())).thenAnswer((_) async {});
115119
});
@@ -155,6 +159,8 @@ void main() {
155159
group('RenegotiationHandler — execute error handling', () {
156160
setUp(() {
157161
when(() => mockErrorReporter.handle(any(), any(), any())).thenReturn(null);
162+
when(() => mockPC.getSenders()).thenAnswer((_) async => []);
163+
when(() => mockPC.getReceivers()).thenAnswer((_) async => []);
158164
});
159165

160166
test('reports error via callErrorReporter when execute throws', () async {

0 commit comments

Comments
 (0)