forked from accurat/react-animated-dataset
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjest.setup.js
More file actions
28 lines (22 loc) · 729 Bytes
/
jest.setup.js
File metadata and controls
28 lines (22 loc) · 729 Bytes
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
import React from 'react'
import { configure } from 'enzyme'
import Adapter16 from 'enzyme-adapter-react-16'
import Adapter17 from '@wojtekmaj/enzyme-adapter-react-17'
import * as accurappConfig from 'jest-config-accurapp'
import * as ReactDOMTestUtils from 'react-dom/test-utils'
import semver from 'semver'
const reactVersion = React.version
const Adapter = semver.lt(reactVersion, '17.0.0')
? Adapter16
: semver.lt(reactVersion, '18.0.0')
? Adapter17
: Adapter17
configure({ adapter: new Adapter() })
global.dispatch = (node, event) =>
ReactDOMTestUtils.act(() => {
node.dispatchEvent(event)
})
global.sleep = ms => new Promise(resolve => setTimeout(resolve, ms))
export default {
...accurappConfig,
}