2
2
import * as React from 'react' ;
3
3
import { Text , TouchableOpacity , View } from 'react-native' ;
4
4
import { fireEvent , render , waitFor } from '..' ;
5
- import { FakeTimerTypes , setupFakeTimers , sleep } from './timerUtils' ;
5
+ import { TimerMode , setupFakeTimers , sleep } from './timerUtils' ;
6
6
7
7
class Banana extends React . Component < any > {
8
8
changeFresh = ( ) => {
@@ -80,7 +80,7 @@ test('waits for element with custom interval', async () => {
80
80
expect ( mockFn ) . toHaveBeenCalledTimes ( 3 ) ;
81
81
} ) ;
82
82
83
- test . each ( FakeTimerTypes ) (
83
+ test . each ( [ TimerMode . Default , TimerMode . Legacy ] ) (
84
84
'waits for element until it stops throwing using %s fake timers' ,
85
85
async ( fakeTimerType ) => {
86
86
setupFakeTimers ( fakeTimerType ) ;
@@ -96,7 +96,7 @@ test.each(FakeTimerTypes)(
96
96
}
97
97
) ;
98
98
99
- test . each ( FakeTimerTypes ) (
99
+ test . each ( [ TimerMode . Default , TimerMode . Legacy ] ) (
100
100
'waits for assertion until timeout is met with %s fake timers' ,
101
101
async ( fakeTimerType ) => {
102
102
setupFakeTimers ( fakeTimerType ) ;
@@ -115,7 +115,7 @@ test.each(FakeTimerTypes)(
115
115
}
116
116
) ;
117
117
118
- test . each ( FakeTimerTypes ) (
118
+ test . each ( [ TimerMode . Default , TimerMode . Legacy ] ) (
119
119
'awaiting something that succeeds before timeout works with %s fake timers' ,
120
120
async ( fakeTimerType ) => {
121
121
setupFakeTimers ( fakeTimerType ) ;
@@ -142,7 +142,7 @@ test.each(FakeTimerTypes)(
142
142
// it is included to show that the previous approach of faking modern timers still works
143
143
// the gotcha is that the try catch will fail to catch the final error, which is why we need to stop throwing
144
144
test ( 'non-awaited approach is not affected by fake modern timers' , async ( ) => {
145
- jest . useFakeTimers ( 'modern' ) ;
145
+ setupFakeTimers ( TimerMode . Modern ) ;
146
146
147
147
let calls = 0 ;
148
148
const mockFn = jest . fn ( ( ) => {
0 commit comments