diff --git a/src/web/setupTests.js b/src/web/setupTests.js index d4967e727c..2097175f86 100644 --- a/src/web/setupTests.js +++ b/src/web/setupTests.js @@ -37,3 +37,17 @@ HTMLAnchorElement.prototype.click = testing.fn(); window.URL.createObjectURL = testing.fn(); global.ResizeObserver = ResizeObserverModule.default; + +// avoid TypeError: window.matchMedia is not a function for @mantine/core/Select +window.matchMedia = testing.fn().mockImplementation(query => { + return { + matches: false, + media: query, + onchange: null, + addListener: testing.fn(), // deprecated + removeListener: testing.fn(), // deprecated + addEventListener: testing.fn(), + removeEventListener: testing.fn(), + dispatchEvent: testing.fn(), + }; +});