@@ -171,7 +171,7 @@ describe('moduleMocker', () => {
171
171
172
172
describe ( 'mocked functions' , ( ) => {
173
173
it ( 'tracks calls to mocks' , ( ) => {
174
- const fn = moduleMocker . getMockFunction ( ) ;
174
+ const fn = moduleMocker . fn ( ) ;
175
175
expect ( fn . mock . calls ) . toEqual ( [ ] ) ;
176
176
177
177
fn ( 1 , 2 , 3 ) ;
@@ -182,7 +182,7 @@ describe('moduleMocker', () => {
182
182
} ) ;
183
183
184
184
it ( 'tracks instances made by mocks' , ( ) => {
185
- const fn = moduleMocker . getMockFunction ( ) ;
185
+ const fn = moduleMocker . fn ( ) ;
186
186
expect ( fn . mock . instances ) . toEqual ( [ ] ) ;
187
187
188
188
const instance1 = new fn ( ) ;
@@ -193,7 +193,7 @@ describe('moduleMocker', () => {
193
193
} ) ;
194
194
195
195
it ( 'supports clearing mock calls' , ( ) => {
196
- const fn = moduleMocker . getMockFunction ( ) ;
196
+ const fn = moduleMocker . fn ( ) ;
197
197
expect ( fn . mock . calls ) . toEqual ( [ ] ) ;
198
198
199
199
fn ( 1 , 2 , 3 ) ;
@@ -211,7 +211,7 @@ describe('moduleMocker', () => {
211
211
} ) ;
212
212
213
213
it ( 'supports clearing mocks' , ( ) => {
214
- const fn = moduleMocker . getMockFunction ( ) ;
214
+ const fn = moduleMocker . fn ( ) ;
215
215
expect ( fn . mock . calls ) . toEqual ( [ ] ) ;
216
216
217
217
fn ( 1 , 2 , 3 ) ;
@@ -225,7 +225,7 @@ describe('moduleMocker', () => {
225
225
} ) ;
226
226
227
227
it ( 'supports resetting mock return values' , ( ) => {
228
- const fn = moduleMocker . getMockFunction ( ) ;
228
+ const fn = moduleMocker . fn ( ) ;
229
229
fn . mockReturnValue ( 'abcd' ) ;
230
230
231
231
const before = fn ( ) ;
@@ -238,7 +238,7 @@ describe('moduleMocker', () => {
238
238
} ) ;
239
239
240
240
it ( 'supports resetting single use mock return values' , ( ) => {
241
- const fn = moduleMocker . getMockFunction ( ) ;
241
+ const fn = moduleMocker . fn ( ) ;
242
242
fn . mockReturnValueOnce ( 'abcd' ) ;
243
243
244
244
fn . mockReset ( ) ;
@@ -248,7 +248,7 @@ describe('moduleMocker', () => {
248
248
} ) ;
249
249
250
250
it ( 'supports resetting mock implementations' , ( ) => {
251
- const fn = moduleMocker . getMockFunction ( ) ;
251
+ const fn = moduleMocker . fn ( ) ;
252
252
fn . mockImplementation ( ( ) => 'abcd' ) ;
253
253
254
254
const before = fn ( ) ;
@@ -261,7 +261,7 @@ describe('moduleMocker', () => {
261
261
} ) ;
262
262
263
263
it ( 'supports resetting single use mock implementations' , ( ) => {
264
- const fn = moduleMocker . getMockFunction ( ) ;
264
+ const fn = moduleMocker . fn ( ) ;
265
265
fn . mockImplementationOnce ( ( ) => 'abcd' ) ;
266
266
267
267
fn . mockReset ( ) ;
@@ -271,12 +271,12 @@ describe('moduleMocker', () => {
271
271
} ) ;
272
272
273
273
it ( 'supports resetting all mocks' , ( ) => {
274
- const fn1 = moduleMocker . getMockFunction ( ) ;
274
+ const fn1 = moduleMocker . fn ( ) ;
275
275
fn1 . mockImplementation ( ( ) => 'abcd' ) ;
276
276
fn1 ( 1 , 2 , 3 ) ;
277
277
expect ( fn1 . mock . calls ) . toEqual ( [ [ 1 , 2 , 3 ] ] ) ;
278
278
279
- const fn2 = moduleMocker . getMockFunction ( ) ;
279
+ const fn2 = moduleMocker . fn ( ) ;
280
280
fn2 . mockReturnValue ( 'abcd' ) ;
281
281
fn2 ( 'a' , 'b' , 'c' ) ;
282
282
expect ( fn2 . mock . calls ) . toEqual ( [ [ 'a' , 'b' , 'c' ] ] ) ;
@@ -292,7 +292,7 @@ describe('moduleMocker', () => {
292
292
293
293
describe ( 'getMockImplementation' , ( ) => {
294
294
it ( 'should mock calls to a mock function' , ( ) => {
295
- const mockFn = moduleMocker . getMockFunction ( ) ;
295
+ const mockFn = moduleMocker . fn ( ) ;
296
296
297
297
mockFn . mockImplementation ( ( ) => {
298
298
return 'Foo' ;
@@ -305,7 +305,7 @@ describe('moduleMocker', () => {
305
305
306
306
describe ( 'mockImplementationOnce' , ( ) => {
307
307
it ( 'should mock single call to a mock function' , ( ) => {
308
- const mockFn = moduleMocker . getMockFunction ( ) ;
308
+ const mockFn = moduleMocker . fn ( ) ;
309
309
310
310
mockFn . mockImplementationOnce ( ( ) => {
311
311
return 'Foo' ;
@@ -319,7 +319,7 @@ describe('moduleMocker', () => {
319
319
} ) ;
320
320
321
321
it ( 'should fallback to default mock function when no specific mock is available' , ( ) => {
322
- const mockFn = moduleMocker . getMockFunction ( ) ;
322
+ const mockFn = moduleMocker . fn ( ) ;
323
323
324
324
mockFn . mockImplementationOnce ( ( ) => {
325
325
return 'Foo' ;
@@ -337,7 +337,7 @@ describe('moduleMocker', () => {
337
337
} ) ;
338
338
339
339
it ( 'should recognize a mocked function' , ( ) => {
340
- const mockFn = moduleMocker . getMockFunction ( ) ;
340
+ const mockFn = moduleMocker . fn ( ) ;
341
341
342
342
expect ( moduleMocker . isMockFunction ( ( ) => { } ) ) . toBe ( false ) ;
343
343
expect ( moduleMocker . isMockFunction ( mockFn ) ) . toBe ( true ) ;
0 commit comments