@@ -121,7 +121,7 @@ describe('FakeTimers', () => {
121
121
} ) ;
122
122
123
123
it ( 'does nothing when no ticks have been scheduled' , ( ) => {
124
- const nextTick = jest . genMockFn ( ) ;
124
+ const nextTick = jest . fn ( ) ;
125
125
const global = {
126
126
process : {
127
127
nextTick,
@@ -145,7 +145,7 @@ describe('FakeTimers', () => {
145
145
const timers = new FakeTimers ( { global, moduleMocker, timerConfig} ) ;
146
146
timers . useFakeTimers ( ) ;
147
147
148
- const mock1 = jest . genMockFn ( ) ;
148
+ const mock1 = jest . fn ( ) ;
149
149
global . process . nextTick ( mock1 ) ;
150
150
expect ( mock1 . mock . calls . length ) . toBe ( 0 ) ;
151
151
@@ -157,7 +157,7 @@ describe('FakeTimers', () => {
157
157
} ) ;
158
158
159
159
it ( 'cancels a callback even from native nextTick' , ( ) => {
160
- const nativeNextTick = jest . genMockFn ( ) ;
160
+ const nativeNextTick = jest . fn ( ) ;
161
161
162
162
const global = {
163
163
process : {
@@ -168,7 +168,7 @@ describe('FakeTimers', () => {
168
168
const timers = new FakeTimers ( { global, moduleMocker, timerConfig} ) ;
169
169
timers . useFakeTimers ( ) ;
170
170
171
- const mock1 = jest . genMockFn ( ) ;
171
+ const mock1 = jest . fn ( ) ;
172
172
global . process . nextTick ( mock1 ) ;
173
173
timers . runAllTicks ( ) ;
174
174
expect ( mock1 . mock . calls . length ) . toBe ( 1 ) ;
@@ -181,7 +181,7 @@ describe('FakeTimers', () => {
181
181
} ) ;
182
182
183
183
it ( 'cancels a callback even from native setImmediate' , ( ) => {
184
- const nativeSetImmediate = jest . genMockFn ( ) ;
184
+ const nativeSetImmediate = jest . fn ( ) ;
185
185
186
186
const global = {
187
187
process,
@@ -191,7 +191,7 @@ describe('FakeTimers', () => {
191
191
const timers = new FakeTimers ( { global, moduleMocker, timerConfig} ) ;
192
192
timers . useFakeTimers ( ) ;
193
193
194
- const mock1 = jest . genMockFn ( ) ;
194
+ const mock1 = jest . fn ( ) ;
195
195
global . setImmediate ( mock1 ) ;
196
196
timers . runAllImmediates ( ) ;
197
197
expect ( mock1 . mock . calls . length ) . toBe ( 1 ) ;
@@ -203,7 +203,7 @@ describe('FakeTimers', () => {
203
203
} ) ;
204
204
205
205
it ( 'doesnt run a tick callback if native nextTick already did' , ( ) => {
206
- const nativeNextTick = jest . genMockFn ( ) ;
206
+ const nativeNextTick = jest . fn ( ) ;
207
207
208
208
const global = {
209
209
process : {
@@ -214,7 +214,7 @@ describe('FakeTimers', () => {
214
214
const timers = new FakeTimers ( { global, moduleMocker, timerConfig} ) ;
215
215
timers . useFakeTimers ( ) ;
216
216
217
- const mock1 = jest . genMockFn ( ) ;
217
+ const mock1 = jest . fn ( ) ;
218
218
global . process . nextTick ( mock1 ) ;
219
219
220
220
// Emulate native nextTick running...
@@ -227,7 +227,7 @@ describe('FakeTimers', () => {
227
227
} ) ;
228
228
229
229
it ( 'doesnt run immediate if native setImmediate already did' , ( ) => {
230
- const nativeSetImmediate = jest . genMockFn ( ) ;
230
+ const nativeSetImmediate = jest . fn ( ) ;
231
231
232
232
const global = {
233
233
process,
@@ -237,7 +237,7 @@ describe('FakeTimers', () => {
237
237
const timers = new FakeTimers ( { global, moduleMocker, timerConfig} ) ;
238
238
timers . useFakeTimers ( ) ;
239
239
240
- const mock1 = jest . genMockFn ( ) ;
240
+ const mock1 = jest . fn ( ) ;
241
241
global . setImmediate ( mock1 ) ;
242
242
243
243
// Emulate native setImmediate running...
@@ -250,7 +250,7 @@ describe('FakeTimers', () => {
250
250
} ) ;
251
251
252
252
it ( 'native doesnt run immediate if fake already did' , ( ) => {
253
- const nativeSetImmediate = jest . genMockFn ( ) ;
253
+ const nativeSetImmediate = jest . fn ( ) ;
254
254
255
255
const global = {
256
256
process,
@@ -260,7 +260,7 @@ describe('FakeTimers', () => {
260
260
const timers = new FakeTimers ( { global, moduleMocker, timerConfig} ) ;
261
261
timers . useFakeTimers ( ) ;
262
262
263
- const mock1 = jest . genMockFn ( ) ;
263
+ const mock1 = jest . fn ( ) ;
264
264
global . setImmediate ( mock1 ) ;
265
265
266
266
//run all immediates now
@@ -358,7 +358,7 @@ describe('FakeTimers', () => {
358
358
} ) ;
359
359
360
360
it ( 'does nothing when no timers have been scheduled' , ( ) => {
361
- const nativeSetTimeout = jest . genMockFn ( ) ;
361
+ const nativeSetTimeout = jest . fn ( ) ;
362
362
const global = {
363
363
process,
364
364
setTimeout : nativeSetTimeout ,
@@ -374,7 +374,7 @@ describe('FakeTimers', () => {
374
374
const timers = new FakeTimers ( { global, moduleMocker, timerConfig} ) ;
375
375
timers . useFakeTimers ( ) ;
376
376
377
- const fn = jest . genMockFn ( ) ;
377
+ const fn = jest . fn ( ) ;
378
378
global . setTimeout ( fn , 0 ) ;
379
379
expect ( fn . mock . calls . length ) . toBe ( 0 ) ;
380
380
@@ -390,15 +390,15 @@ describe('FakeTimers', () => {
390
390
const timers = new FakeTimers ( { global, moduleMocker, timerConfig} ) ;
391
391
timers . useFakeTimers ( ) ;
392
392
393
- const fn = jest . genMockFn ( ) ;
393
+ const fn = jest . fn ( ) ;
394
394
global . setTimeout ( fn , 0 , 'mockArg1' , 'mockArg2' ) ;
395
395
396
396
timers . runAllTimers ( ) ;
397
397
expect ( fn . mock . calls ) . toEqual ( [ [ 'mockArg1' , 'mockArg2' ] ] ) ;
398
398
} ) ;
399
399
400
400
it ( 'doesnt pass the callback to native setTimeout' , ( ) => {
401
- const nativeSetTimeout = jest . genMockFn ( ) ;
401
+ const nativeSetTimeout = jest . fn ( ) ;
402
402
403
403
const global = {
404
404
process,
@@ -408,7 +408,7 @@ describe('FakeTimers', () => {
408
408
const timers = new FakeTimers ( { global, moduleMocker, timerConfig} ) ;
409
409
timers . useFakeTimers ( ) ;
410
410
411
- const mock1 = jest . genMockFn ( ) ;
411
+ const mock1 = jest . fn ( ) ;
412
412
global . setTimeout ( mock1 , 0 ) ;
413
413
414
414
timers . runAllTimers ( ) ;
@@ -445,7 +445,7 @@ describe('FakeTimers', () => {
445
445
const timers = new FakeTimers ( { global, moduleMocker, timerConfig} ) ;
446
446
timers . useFakeTimers ( ) ;
447
447
448
- const fn = jest . genMockFn ( ) ;
448
+ const fn = jest . fn ( ) ;
449
449
global . setTimeout ( ( ) => {
450
450
process . nextTick ( fn ) ;
451
451
} , 0 ) ;
@@ -535,7 +535,7 @@ describe('FakeTimers', () => {
535
535
const timers = new FakeTimers ( { global, moduleMocker, timerConfig} ) ;
536
536
timers . useFakeTimers ( ) ;
537
537
538
- const mock1 = jest . genMockFn ( ) ;
538
+ const mock1 = jest . fn ( ) ;
539
539
global . setTimeout ( mock1 , 100 ) ;
540
540
541
541
timers . reset ( ) ;
@@ -548,7 +548,7 @@ describe('FakeTimers', () => {
548
548
const timers = new FakeTimers ( { global, moduleMocker, timerConfig} ) ;
549
549
timers . useFakeTimers ( ) ;
550
550
551
- const mock1 = jest . genMockFn ( ) ;
551
+ const mock1 = jest . fn ( ) ;
552
552
global . setInterval ( mock1 , 200 ) ;
553
553
554
554
timers . reset ( ) ;
@@ -566,7 +566,7 @@ describe('FakeTimers', () => {
566
566
const timers = new FakeTimers ( { global, moduleMocker, timerConfig} ) ;
567
567
timers . useFakeTimers ( ) ;
568
568
569
- const mock1 = jest . genMockFn ( ) ;
569
+ const mock1 = jest . fn ( ) ;
570
570
global . process . nextTick ( mock1 ) ;
571
571
global . setImmediate ( mock1 ) ;
572
572
@@ -581,7 +581,7 @@ describe('FakeTimers', () => {
581
581
const timers = new FakeTimers ( { global, moduleMocker, timerConfig} ) ;
582
582
timers . useFakeTimers ( ) ;
583
583
584
- const mock1 = jest . genMockFn ( ) ;
584
+ const mock1 = jest . fn ( ) ;
585
585
global . setTimeout ( mock1 , 100 ) ;
586
586
timers . advanceTimersByTime ( 50 ) ;
587
587
@@ -595,7 +595,7 @@ describe('FakeTimers', () => {
595
595
596
596
describe ( 'runOnlyPendingTimers' , ( ) => {
597
597
it ( 'runs all timers in order' , ( ) => {
598
- const nativeSetImmediate = jest . genMockFn ( ) ;
598
+ const nativeSetImmediate = jest . fn ( ) ;
599
599
600
600
const global = {
601
601
process,
@@ -653,7 +653,7 @@ describe('FakeTimers', () => {
653
653
const timers = new FakeTimers ( { global, moduleMocker, timerConfig} ) ;
654
654
timers . useFakeTimers ( ) ;
655
655
656
- const fn = jest . genMockFn ( ) ;
656
+ const fn = jest . fn ( ) ;
657
657
const timer = global . setTimeout ( fn , 10 ) ;
658
658
global . setTimeout ( ( ) => {
659
659
global . clearTimeout ( timer ) ;
@@ -666,10 +666,10 @@ describe('FakeTimers', () => {
666
666
667
667
describe ( 'runWithRealTimers' , ( ) => {
668
668
it ( 'executes callback with native timers' , ( ) => {
669
- const nativeClearInterval = jest . genMockFn ( ) ;
670
- const nativeClearTimeout = jest . genMockFn ( ) ;
671
- const nativeSetInterval = jest . genMockFn ( ) ;
672
- const nativeSetTimeout = jest . genMockFn ( ) ;
669
+ const nativeClearInterval = jest . fn ( ) ;
670
+ const nativeClearTimeout = jest . fn ( ) ;
671
+ const nativeSetInterval = jest . fn ( ) ;
672
+ const nativeSetTimeout = jest . fn ( ) ;
673
673
674
674
const global = {
675
675
clearInterval : nativeClearInterval ,
@@ -711,10 +711,10 @@ describe('FakeTimers', () => {
711
711
} ) ;
712
712
713
713
it ( 'resets mock timers after executing callback' , ( ) => {
714
- const nativeClearInterval = jest . genMockFn ( ) ;
715
- const nativeClearTimeout = jest . genMockFn ( ) ;
716
- const nativeSetInterval = jest . genMockFn ( ) ;
717
- const nativeSetTimeout = jest . genMockFn ( ) ;
714
+ const nativeClearInterval = jest . fn ( ) ;
715
+ const nativeClearTimeout = jest . fn ( ) ;
716
+ const nativeSetInterval = jest . fn ( ) ;
717
+ const nativeSetTimeout = jest . fn ( ) ;
718
718
719
719
const global = {
720
720
clearInterval : nativeClearInterval ,
@@ -772,7 +772,7 @@ describe('FakeTimers', () => {
772
772
} ) ;
773
773
774
774
it ( 'resets mock timer functions even if callback throws' , ( ) => {
775
- const nativeSetTimeout = jest . genMockFn ( ) ;
775
+ const nativeSetTimeout = jest . fn ( ) ;
776
776
const global = {
777
777
process,
778
778
setTimeout : nativeSetTimeout ,
@@ -797,10 +797,10 @@ describe('FakeTimers', () => {
797
797
798
798
describe ( 'useRealTimers' , ( ) => {
799
799
it ( 'resets native timer APIs' , ( ) => {
800
- const nativeSetTimeout = jest . genMockFn ( ) ;
801
- const nativeSetInterval = jest . genMockFn ( ) ;
802
- const nativeClearTimeout = jest . genMockFn ( ) ;
803
- const nativeClearInterval = jest . genMockFn ( ) ;
800
+ const nativeSetTimeout = jest . fn ( ) ;
801
+ const nativeSetInterval = jest . fn ( ) ;
802
+ const nativeClearTimeout = jest . fn ( ) ;
803
+ const nativeClearInterval = jest . fn ( ) ;
804
804
805
805
const global = {
806
806
clearInterval : nativeClearInterval ,
@@ -828,7 +828,7 @@ describe('FakeTimers', () => {
828
828
} ) ;
829
829
830
830
it ( 'resets native process.nextTick when present' , ( ) => {
831
- const nativeProcessNextTick = jest . genMockFn ( ) ;
831
+ const nativeProcessNextTick = jest . fn ( ) ;
832
832
833
833
const global = {
834
834
process : { nextTick : nativeProcessNextTick } ,
@@ -846,8 +846,8 @@ describe('FakeTimers', () => {
846
846
} ) ;
847
847
848
848
it ( 'resets native setImmediate when present' , ( ) => {
849
- const nativeSetImmediate = jest . genMockFn ( ) ;
850
- const nativeClearImmediate = jest . genMockFn ( ) ;
849
+ const nativeSetImmediate = jest . fn ( ) ;
850
+ const nativeClearImmediate = jest . fn ( ) ;
851
851
852
852
const global = {
853
853
clearImmediate : nativeClearImmediate ,
@@ -871,10 +871,10 @@ describe('FakeTimers', () => {
871
871
872
872
describe ( 'useFakeTimers' , ( ) => {
873
873
it ( 'resets mock timer APIs' , ( ) => {
874
- const nativeSetTimeout = jest . genMockFn ( ) ;
875
- const nativeSetInterval = jest . genMockFn ( ) ;
876
- const nativeClearTimeout = jest . genMockFn ( ) ;
877
- const nativeClearInterval = jest . genMockFn ( ) ;
874
+ const nativeSetTimeout = jest . fn ( ) ;
875
+ const nativeSetInterval = jest . fn ( ) ;
876
+ const nativeClearTimeout = jest . fn ( ) ;
877
+ const nativeClearInterval = jest . fn ( ) ;
878
878
879
879
const global = {
880
880
clearInterval : nativeClearInterval ,
@@ -902,7 +902,7 @@ describe('FakeTimers', () => {
902
902
} ) ;
903
903
904
904
it ( 'resets mock process.nextTick when present' , ( ) => {
905
- const nativeProcessNextTick = jest . genMockFn ( ) ;
905
+ const nativeProcessNextTick = jest . fn ( ) ;
906
906
907
907
const global = {
908
908
process : { nextTick : nativeProcessNextTick } ,
@@ -920,8 +920,8 @@ describe('FakeTimers', () => {
920
920
} ) ;
921
921
922
922
it ( 'resets mock setImmediate when present' , ( ) => {
923
- const nativeSetImmediate = jest . genMockFn ( ) ;
924
- const nativeClearImmediate = jest . genMockFn ( ) ;
923
+ const nativeSetImmediate = jest . fn ( ) ;
924
+ const nativeClearImmediate = jest . fn ( ) ;
925
925
926
926
const global = {
927
927
clearImmediate : nativeClearImmediate ,
0 commit comments