File tree 1 file changed +9
-7
lines changed
1 file changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -30,7 +30,9 @@ describe("Timer tests", () => {
30
30
</ BoardContext . Provider >
31
31
) ;
32
32
33
- timerRef . current . start ( ) ;
33
+ act ( ( ) => {
34
+ timerRef . current . start ( ) ;
35
+ } ) ;
34
36
35
37
expect ( timerRef . current . isRunning ( ) ) . toBe ( true ) ;
36
38
} ) ;
@@ -44,9 +46,11 @@ describe("Timer tests", () => {
44
46
</ BoardContext . Provider >
45
47
) ;
46
48
47
- timerRef . current . start ( ) ;
48
- boardContext . ctx . gameover = { isWin : true } ;
49
+ act ( ( ) => {
50
+ timerRef . current . start ( ) ;
51
+ } ) ;
49
52
53
+ boardContext . ctx . gameover = { isWin : true } ;
50
54
rerender (
51
55
< BoardContext . Provider value = { boardContext } >
52
56
< Timer ref = { timerRef } />
@@ -65,9 +69,8 @@ describe("Timer tests", () => {
65
69
</ BoardContext . Provider >
66
70
) ;
67
71
68
- timerRef . current . start ( ) ;
69
-
70
72
act ( ( ) => {
73
+ timerRef . current . start ( ) ;
71
74
vi . advanceTimersByTime ( 5000 ) ;
72
75
} ) ;
73
76
@@ -85,9 +88,8 @@ describe("Timer tests", () => {
85
88
</ BoardContext . Provider >
86
89
) ;
87
90
88
- timerRef . current . start ( ) ;
89
-
90
91
act ( ( ) => {
92
+ timerRef . current . start ( ) ;
91
93
vi . advanceTimersByTime ( 5000 ) ;
92
94
} ) ;
93
95
You can’t perform that action at this time.
0 commit comments