File tree 2 files changed +13
-1
lines changed
2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -14,6 +14,12 @@ test('render calls useEffect immediately', () => {
14
14
expect ( effectCb ) . toHaveBeenCalledTimes ( 1 )
15
15
} )
16
16
17
+ test ( 'findByTestId returns the element' , async ( ) => {
18
+ const ref = React . createRef ( )
19
+ const { findByTestId} = render ( < div ref = { ref } data-testid = "foo" /> )
20
+ expect ( await findByTestId ( 'foo' ) ) . toBe ( ref . current )
21
+ } )
22
+
17
23
test ( 'fireEvent triggers useEffect calls' , ( ) => {
18
24
const effectCb = jest . fn ( )
19
25
function Counter ( ) {
Original file line number Diff line number Diff line change @@ -9,7 +9,13 @@ import {
9
9
import act , { asyncAct } from './act-compat'
10
10
11
11
configureDTL ( {
12
- asyncWrapper : asyncAct ,
12
+ asyncWrapper : async cb => {
13
+ let result
14
+ await asyncAct ( async ( ) => {
15
+ result = await cb ( )
16
+ } )
17
+ return result
18
+ } ,
13
19
} )
14
20
15
21
const mountedContainers = new Set ( )
You can’t perform that action at this time.
0 commit comments