Skip to content

Commit

Permalink
test: Create mock in jest.setup (#200)
Browse files Browse the repository at this point in the history
  • Loading branch information
steezplusplus authored Jun 24, 2024
1 parent 8c1d192 commit 41e441f
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions jest.setup.ts
Original file line number Diff line number Diff line change
@@ -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;
},
});

0 comments on commit 41e441f

Please sign in to comment.