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 7147436
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
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"]
}
13 changes: 13 additions & 0 deletions src/setup.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
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(),
})),
});
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@
"baseUrl": "src"
},
"allowImportingTsExtensions": true,
"include": ["src"]
"include": ["src", "src/setup.ts"]
}

0 comments on commit 7147436

Please sign in to comment.