Mocking WebRTC for React Testing

Hello!

I’m looking to write React tests for my WebRTC implementation. Any suggestions for how to mock/what to mock for the connections to establish?

Possibly as a follow-up, what test functionality would demonstrate WebRTC robustness (in your opinion)? Would I need to create a peer connection and stream?

Thanks!

As a follow-up, I’m getting an error about RTCPeerConnection when I try to render the component using React Test Renderer. Here’s the error:

TypeError: Cannot read property 'peerConnectionInit' of undefined

    > 74 |   let peerConn = new RTCPeerConnection({
         |                  ^
      75 |     iceServers: [
      76 |       {
      77 |         urls: CONNECTION_CONSTANTS.STUN_SERVER,
      78 |       }
      79 |     ],
      80 |   });