@@ -1225,7 +1225,7 @@ describe('React', () => {
1225
1225
function AwesomeMap ( ) { }
1226
1226
1227
1227
let spy = jest . spyOn ( console , 'error' ) . mockImplementation ( ( ) => { } )
1228
- enzyme . mount (
1228
+ rtl . render (
1229
1229
< ProviderMock store = { store } >
1230
1230
{ makeContainer ( ( ) => 1 , ( ) => ( { } ) , ( ) => ( { } ) ) }
1231
1231
</ ProviderMock >
@@ -1235,9 +1235,10 @@ describe('React', () => {
1235
1235
/ m a p S t a t e T o P r o p s \( \) i n C o n n e c t \( C o n t a i n e r \) m u s t r e t u r n a p l a i n o b j e c t /
1236
1236
)
1237
1237
spy . mockRestore ( )
1238
+ rtl . cleanup ( )
1238
1239
1239
1240
spy = jest . spyOn ( console , 'error' ) . mockImplementation ( ( ) => { } )
1240
- enzyme . mount (
1241
+ rtl . render (
1241
1242
< ProviderMock store = { store } >
1242
1243
{ makeContainer ( ( ) => 'hey' , ( ) => ( { } ) , ( ) => ( { } ) ) }
1243
1244
</ ProviderMock >
@@ -1247,9 +1248,10 @@ describe('React', () => {
1247
1248
/ m a p S t a t e T o P r o p s \( \) i n C o n n e c t \( C o n t a i n e r \) m u s t r e t u r n a p l a i n o b j e c t /
1248
1249
)
1249
1250
spy . mockRestore ( )
1251
+ rtl . cleanup ( )
1250
1252
1251
1253
spy = jest . spyOn ( console , 'error' ) . mockImplementation ( ( ) => { } )
1252
- enzyme . mount (
1254
+ rtl . render (
1253
1255
< ProviderMock store = { store } >
1254
1256
{ makeContainer ( ( ) => new AwesomeMap ( ) , ( ) => ( { } ) , ( ) => ( { } ) ) }
1255
1257
</ ProviderMock >
@@ -1259,9 +1261,10 @@ describe('React', () => {
1259
1261
/ m a p S t a t e T o P r o p s \( \) i n C o n n e c t \( C o n t a i n e r \) m u s t r e t u r n a p l a i n o b j e c t /
1260
1262
)
1261
1263
spy . mockRestore ( )
1264
+ rtl . cleanup ( )
1262
1265
1263
1266
spy = jest . spyOn ( console , 'error' ) . mockImplementation ( ( ) => { } )
1264
- enzyme . mount (
1267
+ rtl . render (
1265
1268
< ProviderMock store = { store } >
1266
1269
{ makeContainer ( ( ) => ( { } ) , ( ) => 1 , ( ) => ( { } ) ) }
1267
1270
</ ProviderMock >
@@ -1271,9 +1274,10 @@ describe('React', () => {
1271
1274
/ m a p D i s p a t c h T o P r o p s \( \) i n C o n n e c t \( C o n t a i n e r \) m u s t r e t u r n a p l a i n o b j e c t /
1272
1275
)
1273
1276
spy . mockRestore ( )
1277
+ rtl . cleanup ( )
1274
1278
1275
1279
spy = jest . spyOn ( console , 'error' ) . mockImplementation ( ( ) => { } )
1276
- enzyme . mount (
1280
+ rtl . render (
1277
1281
< ProviderMock store = { store } >
1278
1282
{ makeContainer ( ( ) => ( { } ) , ( ) => 'hey' , ( ) => ( { } ) ) }
1279
1283
</ ProviderMock >
@@ -1283,9 +1287,10 @@ describe('React', () => {
1283
1287
/ m a p D i s p a t c h T o P r o p s \( \) i n C o n n e c t \( C o n t a i n e r \) m u s t r e t u r n a p l a i n o b j e c t /
1284
1288
)
1285
1289
spy . mockRestore ( )
1290
+ rtl . cleanup ( )
1286
1291
1287
1292
spy = jest . spyOn ( console , 'error' ) . mockImplementation ( ( ) => { } )
1288
- enzyme . mount (
1293
+ rtl . render (
1289
1294
< ProviderMock store = { store } >
1290
1295
{ makeContainer ( ( ) => ( { } ) , ( ) => new AwesomeMap ( ) , ( ) => ( { } ) ) }
1291
1296
</ ProviderMock >
@@ -1295,9 +1300,10 @@ describe('React', () => {
1295
1300
/ m a p D i s p a t c h T o P r o p s \( \) i n C o n n e c t \( C o n t a i n e r \) m u s t r e t u r n a p l a i n o b j e c t /
1296
1301
)
1297
1302
spy . mockRestore ( )
1303
+ rtl . cleanup ( )
1298
1304
1299
1305
spy = jest . spyOn ( console , 'error' ) . mockImplementation ( ( ) => { } )
1300
- enzyme . mount (
1306
+ rtl . render (
1301
1307
< ProviderMock store = { store } >
1302
1308
{ makeContainer ( ( ) => ( { } ) , ( ) => ( { } ) , ( ) => 1 ) }
1303
1309
</ ProviderMock >
@@ -1307,9 +1313,10 @@ describe('React', () => {
1307
1313
/ m e r g e P r o p s \( \) i n C o n n e c t \( C o n t a i n e r \) m u s t r e t u r n a p l a i n o b j e c t /
1308
1314
)
1309
1315
spy . mockRestore ( )
1316
+ rtl . cleanup ( )
1310
1317
1311
1318
spy = jest . spyOn ( console , 'error' ) . mockImplementation ( ( ) => { } )
1312
- enzyme . mount (
1319
+ rtl . render (
1313
1320
< ProviderMock store = { store } >
1314
1321
{ makeContainer ( ( ) => ( { } ) , ( ) => ( { } ) , ( ) => 'hey' ) }
1315
1322
</ ProviderMock >
@@ -1319,9 +1326,10 @@ describe('React', () => {
1319
1326
/ m e r g e P r o p s \( \) i n C o n n e c t \( C o n t a i n e r \) m u s t r e t u r n a p l a i n o b j e c t /
1320
1327
)
1321
1328
spy . mockRestore ( )
1329
+ rtl . cleanup ( )
1322
1330
1323
1331
spy = jest . spyOn ( console , 'error' ) . mockImplementation ( ( ) => { } )
1324
- enzyme . mount (
1332
+ rtl . render (
1325
1333
< ProviderMock store = { store } >
1326
1334
{ makeContainer ( ( ) => ( { } ) , ( ) => ( { } ) , ( ) => new AwesomeMap ( ) ) }
1327
1335
</ ProviderMock >
@@ -1373,23 +1381,21 @@ describe('React', () => {
1373
1381
}
1374
1382
1375
1383
let container
1376
- const testRenderer = enzyme . mount (
1384
+ const tester = rtl . render (
1377
1385
< ProviderMock store = { store } >
1378
1386
< ContainerBefore ref = { instance => container = instance } />
1379
1387
</ ProviderMock >
1380
1388
)
1381
- expect ( testRenderer . find ( Passthrough ) . prop ( 'foo' ) ) . toEqual ( undefined )
1382
- expect ( testRenderer . find ( Passthrough ) . prop ( 'scooby' ) ) . toEqual ( 'doo' )
1389
+ expect ( tester . queryByTestId ( 'foo' ) ) . toBe ( null )
1390
+ expect ( tester . getByTestId ( 'scooby' ) ) . toHaveTextContent ( 'doo' )
1383
1391
1384
1392
imitateHotReloading ( ContainerBefore , ContainerAfter , container )
1385
- testRenderer . update ( )
1386
- expect ( testRenderer . find ( Passthrough ) . prop ( 'foo' ) ) . toEqual ( 'baz' )
1387
- expect ( testRenderer . find ( Passthrough ) . prop ( 'scooby' ) ) . toEqual ( 'foo' )
1393
+ expect ( tester . getByTestId ( 'foo' ) ) . toHaveTextContent ( 'baz' )
1394
+ expect ( tester . getByTestId ( 'scooby' ) ) . toHaveTextContent ( 'foo' )
1388
1395
1389
1396
imitateHotReloading ( ContainerBefore , ContainerNext , container )
1390
- testRenderer . update ( )
1391
- expect ( testRenderer . find ( Passthrough ) . prop ( 'foo' ) ) . toEqual ( 'bar' )
1392
- expect ( testRenderer . find ( Passthrough ) . prop ( 'scooby' ) ) . toEqual ( 'boo' )
1397
+ expect ( tester . getByTestId ( 'foo' ) ) . toHaveTextContent ( 'bar' )
1398
+ expect ( tester . getByTestId ( 'scooby' ) ) . toHaveTextContent ( 'boo' )
1393
1399
} )
1394
1400
1395
1401
it ( 'should persist listeners through hot update' , ( ) => {
@@ -1438,7 +1444,7 @@ describe('React', () => {
1438
1444
}
1439
1445
1440
1446
let container
1441
- const testRenderer = enzyme . mount (
1447
+ const tester = rtl . render (
1442
1448
< ProviderMock store = { store } >
1443
1449
< ParentBefore ref = { instance => container = instance } />
1444
1450
</ ProviderMock >
@@ -1447,9 +1453,8 @@ describe('React', () => {
1447
1453
imitateHotReloading ( ParentBefore , ParentAfter , container )
1448
1454
1449
1455
store . dispatch ( { type : ACTION_TYPE } )
1450
- testRenderer . update ( )
1451
1456
1452
- expect ( testRenderer . find ( Passthrough ) . prop ( 'actions' ) ) . toEqual ( 1 )
1457
+ expect ( tester . getByTestId ( 'actions' ) ) . toHaveTextContent ( '1' )
1453
1458
} )
1454
1459
1455
1460
it ( 'should set the displayName correctly' , ( ) => {
@@ -1535,7 +1540,7 @@ describe('React', () => {
1535
1540
getState : ( ) => expectedState
1536
1541
}
1537
1542
1538
- enzyme . mount ( < Decorated store = { mockStore } /> )
1543
+ rtl . render ( < Decorated store = { mockStore } /> )
1539
1544
1540
1545
expect ( actualState ) . toEqual ( expectedState )
1541
1546
} )
@@ -1553,7 +1558,7 @@ describe('React', () => {
1553
1558
const Decorated = decorator ( Container )
1554
1559
1555
1560
expect ( ( ) =>
1556
- enzyme . mount ( < Decorated /> )
1561
+ rtl . render ( < Decorated /> )
1557
1562
) . toThrow (
1558
1563
/ C o u l d n o t f i n d " s t o r e " /
1559
1564
)
0 commit comments