1
1
import React from 'react'
2
- import { render , cleanup , act } from '../'
2
+ import { render , cleanup } from '../'
3
3
4
- test ( 'cleans up the document' , async ( ) => {
4
+ test ( 'cleans up the document' , ( ) => {
5
5
const spy = jest . fn ( )
6
6
const divId = 'my-div'
7
7
@@ -17,17 +17,17 @@ test('cleans up the document', async () => {
17
17
}
18
18
19
19
render ( < Test /> )
20
- await cleanup ( )
20
+ cleanup ( )
21
21
expect ( document . body ) . toBeEmptyDOMElement ( )
22
22
expect ( spy ) . toHaveBeenCalledTimes ( 1 )
23
23
} )
24
24
25
- test ( 'cleanup does not error when an element is not a child' , async ( ) => {
25
+ test ( 'cleanup does not error when an element is not a child' , ( ) => {
26
26
render ( < div /> , { container : document . createElement ( 'div' ) } )
27
- await cleanup ( )
27
+ cleanup ( )
28
28
} )
29
29
30
- test ( 'cleanup runs effect cleanup functions' , async ( ) => {
30
+ test ( 'cleanup runs effect cleanup functions' , ( ) => {
31
31
const spy = jest . fn ( )
32
32
33
33
const Test = ( ) => {
@@ -37,7 +37,7 @@ test('cleanup runs effect cleanup functions', async () => {
37
37
}
38
38
39
39
render ( < Test /> )
40
- await cleanup ( )
40
+ cleanup ( )
41
41
expect ( spy ) . toHaveBeenCalledTimes ( 1 )
42
42
} )
43
43
@@ -54,7 +54,7 @@ describe('fake timers and missing act warnings', () => {
54
54
jest . useRealTimers ( )
55
55
} )
56
56
57
- test ( 'cleanup does not flush immediates' , async ( ) => {
57
+ test ( 'cleanup does not flush immediates' , ( ) => {
58
58
const microTaskSpy = jest . fn ( )
59
59
function Test ( ) {
60
60
const counter = 1
@@ -77,15 +77,15 @@ describe('fake timers and missing act warnings', () => {
77
77
}
78
78
render ( < Test /> )
79
79
80
- await cleanup ( )
80
+ cleanup ( )
81
81
82
82
expect ( microTaskSpy ) . toHaveBeenCalledTimes ( 0 )
83
83
// console.error is mocked
84
84
// eslint-disable-next-line no-console
85
85
expect ( console . error ) . toHaveBeenCalledTimes ( 0 )
86
86
} )
87
87
88
- test ( 'cleanup does not swallow missing act warnings' , async ( ) => {
88
+ test ( 'cleanup does not swallow missing act warnings' , ( ) => {
89
89
const deferredStateUpdateSpy = jest . fn ( )
90
90
function Test ( ) {
91
91
const counter = 1
@@ -109,7 +109,7 @@ describe('fake timers and missing act warnings', () => {
109
109
render ( < Test /> )
110
110
111
111
jest . runAllImmediates ( )
112
- await cleanup ( )
112
+ cleanup ( )
113
113
114
114
expect ( deferredStateUpdateSpy ) . toHaveBeenCalledTimes ( 1 )
115
115
// console.error is mocked
0 commit comments