@@ -258,11 +258,11 @@ describe('ReactShallowRenderer with hooks', () => {
258
258
259
259
function SomeComponent ( { defaultName} ) {
260
260
React . useEffect ( ( ) => {
261
- happenings . push ( 'call effect' ) ;
261
+ happenings . push ( 'create effect' ) ;
262
262
} ) ;
263
263
264
264
React . useLayoutEffect ( ( ) => {
265
- happenings . push ( 'call layout effect' ) ;
265
+ happenings . push ( 'create layout effect' ) ;
266
266
} ) ;
267
267
268
268
happenings . push ( 'render' ) ;
@@ -276,52 +276,52 @@ describe('ReactShallowRenderer with hooks', () => {
276
276
// Note the layout effect is triggered first.
277
277
expect ( happenings ) . toEqual ( [
278
278
'render' ,
279
- 'call layout effect' ,
280
- 'call effect' ,
279
+ 'create layout effect' ,
280
+ 'create effect' ,
281
281
] ) ;
282
282
} ) ;
283
283
284
- it ( 'should trigger effects and cleanup depending on inputs' , ( ) => {
284
+ it ( 'should trigger effects and destroy depending on inputs' , ( ) => {
285
285
let _setFriend ;
286
286
const happenings = [ ] ;
287
287
288
288
function SomeComponent ( ) {
289
289
const [ friend , setFriend ] = React . useState ( 'Bons' ) ;
290
- const [ cat ] = React . useState ( 'Muskus' ) ;
290
+ const cat = 'Muskus' ;
291
291
_setFriend = setFriend ;
292
292
293
293
React . useEffect (
294
294
( ) => {
295
- happenings . push ( 'call friend effect' ) ;
295
+ happenings . push ( 'create friend effect' ) ;
296
296
return ( ) => {
297
- happenings . push ( 'cleanup friend effect' ) ;
297
+ happenings . push ( 'destroy friend effect' ) ;
298
298
} ;
299
299
} ,
300
300
[ friend ] ,
301
301
) ;
302
302
303
303
React . useEffect ( ( ) => {
304
- happenings . push ( 'call empty effect' ) ;
304
+ happenings . push ( 'create empty effect' ) ;
305
305
return ( ) => {
306
- happenings . push ( 'cleanup empty effect' ) ;
306
+ happenings . push ( 'destroy empty effect' ) ;
307
307
} ;
308
308
} ) ;
309
309
310
310
React . useEffect (
311
311
( ) => {
312
- happenings . push ( 'call cat effect' ) ;
312
+ happenings . push ( 'create cat effect' ) ;
313
313
return ( ) => {
314
- happenings . push ( 'cleanup cat effect' ) ;
314
+ happenings . push ( 'destroy cat effect' ) ;
315
315
} ;
316
316
} ,
317
317
[ cat ] ,
318
318
) ;
319
319
320
320
React . useEffect (
321
321
( ) => {
322
- happenings . push ( 'call both effect' ) ;
322
+ happenings . push ( 'create both effect' ) ;
323
323
return ( ) => {
324
- happenings . push ( 'cleanup both effect' ) ;
324
+ happenings . push ( 'destroy both effect' ) ;
325
325
} ;
326
326
} ,
327
327
[ friend , cat ] ,
@@ -338,21 +338,21 @@ describe('ReactShallowRenderer with hooks', () => {
338
338
shallowRenderer . render ( < SomeComponent /> ) ;
339
339
340
340
expect ( happenings ) . toEqual ( [
341
- 'call friend effect' ,
342
- 'call empty effect' ,
343
- 'call cat effect' ,
344
- 'call both effect' ,
341
+ 'create friend effect' ,
342
+ 'create empty effect' ,
343
+ 'create cat effect' ,
344
+ 'create both effect' ,
345
345
] ) ;
346
346
347
347
happenings . splice ( 0 ) ;
348
348
_setFriend ( 'Maryam' ) ;
349
349
expect ( happenings ) . toEqual ( [
350
- 'cleanup friend effect' ,
351
- 'call friend effect' ,
352
- 'cleanup empty effect' ,
353
- 'call empty effect' ,
354
- 'cleanup both effect' ,
355
- 'call both effect' ,
350
+ 'destroy friend effect' ,
351
+ 'create friend effect' ,
352
+ 'destroy empty effect' ,
353
+ 'create empty effect' ,
354
+ 'destroy both effect' ,
355
+ 'create both effect' ,
356
356
] ) ;
357
357
} ) ;
358
358
} ) ;
0 commit comments