Skip to content

Commit

Permalink
fix(build): fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
lailabjil committed Dec 12, 2023
1 parent 2039f26 commit b0b203c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion jest.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@
"^@mui/material$": "<rootDir>/node_modules/@mui/material"
},
"transformIgnorePatterns": ["node_modules/(?!(axios)/)", "<rootDir>/node_modules/"],
"setupFiles": ["fake-indexeddb/auto"]
"setupFiles": ["fake-indexeddb/auto", "<rootDir>/src/setup.ts"]
}
15 changes: 15 additions & 0 deletions src/setup.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Object.defineProperty(window, "matchMedia", {
writable: true,
value: jest.fn().mockImplementation(query => ({
matches: false,
media: query,
onchange: null,
addListener: jest.fn(), // Deprecated
removeListener: jest.fn(), // Deprecated
addEventListener: jest.fn(),
removeEventListener: jest.fn(),
dispatchEvent: jest.fn(),
})),
});

export {};

0 comments on commit b0b203c

Please sign in to comment.