Skip to content

Commit dc90357

Browse files
committed
fix(voip): update integration test assertions to use voipNative.recorded
Replace direct RNCallKeep/InCallManager assertions with voipNative.recorded checks; voipNative is InMemoryVoipNative in test mode so native calls are not made directly
1 parent da426f6 commit dc90357

1 file changed

Lines changed: 6 additions & 7 deletions

File tree

app/containers/NewMediaCall/VoipCallLifecycle.integration.test.tsx

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -565,7 +565,7 @@ describe('VoIP call lifecycle (integration)', () => {
565565
await flushMicrotasks();
566566
});
567567

568-
expect(RNCallKeep.setCurrentCallActive as jest.Mock).toHaveBeenCalledWith('incoming-1');
568+
expect((voipNative as InMemoryVoipNative).recorded).toContainEqual({ cmd: 'markActive', callUuid: 'incoming-1' });
569569
expect(Navigation.navigate).toHaveBeenCalledWith('CallView');
570570
expect(useCallStore.getState().call?.callId).toBe('incoming-1');
571571
});
@@ -641,7 +641,7 @@ describe('VoIP call lifecycle (integration)', () => {
641641
});
642642

643643
expect((voipNative as InMemoryVoipNative).recorded).toContainEqual({ cmd: 'end', callUuid: 'call-user-1' });
644-
expect(InCallManager.stop as jest.Mock).toHaveBeenCalled();
644+
expect((voipNative as InMemoryVoipNative).recorded).toContainEqual({ cmd: 'stopAudio' });
645645
expect(useCallStore.getState().call).toBeNull();
646646
expect(useCallStore.getState().callId).toBeNull();
647647
});
@@ -656,8 +656,7 @@ describe('VoIP call lifecycle (integration)', () => {
656656
});
657657

658658
expect((voipNative as InMemoryVoipNative).recorded).toContainEqual({ cmd: 'end', callUuid: 'active-1' });
659-
expect(RNCallKeep.setCurrentCallActive as jest.Mock).toHaveBeenCalledWith('');
660-
expect(RNCallKeep.setAvailable as jest.Mock).toHaveBeenCalledWith(true);
659+
expect((voipNative as InMemoryVoipNative).recorded).toContainEqual({ cmd: 'markAvailable', callUuid: 'active-1' });
661660
expect(useCallStore.getState().call).toBeNull();
662661
});
663662

@@ -749,13 +748,13 @@ describe('VoIP call lifecycle (integration)', () => {
749748
await act(async () => {
750749
await useCallStore.getState().toggleSpeaker();
751750
});
752-
expect(InCallManager.setForceSpeakerphoneOn as jest.Mock).toHaveBeenCalledWith(true);
751+
expect((voipNative as InMemoryVoipNative).recorded).toContainEqual({ cmd: 'setSpeaker', on: true });
753752
expect(useCallStore.getState().isSpeakerOn).toBe(true);
754753

755754
await act(async () => {
756755
await useCallStore.getState().toggleSpeaker();
757756
});
758-
expect(InCallManager.setForceSpeakerphoneOn as jest.Mock).toHaveBeenCalledWith(false);
757+
expect((voipNative as InMemoryVoipNative).recorded).toContainEqual({ cmd: 'setSpeaker', on: false });
759758
expect(useCallStore.getState().isSpeakerOn).toBe(false);
760759
});
761760
});
@@ -846,7 +845,7 @@ describe('VoIP call lifecycle (integration)', () => {
846845

847846
expect(useCallStore.getState().callState).toBe('active');
848847
expect(useCallStore.getState().callStartTime).not.toBeNull();
849-
expect(RNCallKeep.setCurrentCallActive as jest.Mock).toHaveBeenCalledWith('state-1');
848+
expect((voipNative as InMemoryVoipNative).recorded).toContainEqual({ cmd: 'markActive', callUuid: 'state-1' });
850849
});
851850
});
852851

0 commit comments

Comments
 (0)