-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathjest.setup.js
More file actions
46 lines (40 loc) · 1.01 KB
/
jest.setup.js
File metadata and controls
46 lines (40 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
// optional: configure or set up a testing framework before each test
// if you delete this file, remove `setupFilesAfterEnv` from `jest.config.js`
// used for __tests__/testing-library.js
// learn more: https://github.com/testing-library/jest-dom
require('@testing-library/jest-dom/extend-expect');
const { toHaveNoViolations } = require('jest-axe');
expect.extend(toHaveNoViolations);
window.ResizeObserver = class ResizeObserver {
constructor(cb) {
this.cb = cb;
}
observe() {
this.cb([{ borderBoxSize: { inlineSize: 0, blockSize: 0 } }]);
}
unobserve() {
// do nothing
}
};
window.DOMRect = {
fromRect: () => ({
top: 0,
left: 0,
bottom: 0,
right: 0,
width: 0,
height: 0,
}),
};
window.matchMedia =
window.matchMedia ||
function () {
return {
matches: false,
addListener: function () {},
removeListener: function () {},
addEventListener: function () {},
removeEventListener: function () {},
dispatchEvent: function () {},
};
};