diff --git a/jest.setup.ts b/jest.setup.ts index 7b0828b..9c3140b 100644 --- a/jest.setup.ts +++ b/jest.setup.ts @@ -1 +1,11 @@ import '@testing-library/jest-dom'; + +// Jest uses "jsdom" environment for running tests which does not implement all browser API's +// So I have this mock the HTMLMediaElement.prototype.play method +Object.defineProperty(window.HTMLMediaElement.prototype, 'play', { + configurable: true, + get() { + const original = jest.fn(); + return original; + }, +});