-
-
Notifications
You must be signed in to change notification settings - Fork 6.6k
Description
Hi there, I am trying to create a web application with React and I am currently using jest to test my React app. However, there is a feature where I am using the MediaRecorder Api to record a media stream in the web application, so when I write a simple test to check if that component has rendered using jest, it fails because it tells me: "ReferenceError: MediaRecorder is not defined" in the application at
let mediaRecorder = new MediaRecorder(stream, options);.
I hear that jsdom doesn't have the mediarecorderAPI so I was trying to mock it, but I am super stuck on how to mock the MediaRecorder object or create a fake MediaRecorder object with a fake constructor that does nothing. If anyone has an idea on how to do it, please let me know 🙏
And Thank you for your help!