@@ -466,7 +466,7 @@ describe('React', () => {
466
466
outerComponent . setFoo ( 'BAR' )
467
467
outerComponent . setFoo ( 'DID' )
468
468
469
- expect ( invocationCount ) . toEqual ( 2 )
469
+ expect ( invocationCount ) . toEqual ( 1 )
470
470
} )
471
471
472
472
it ( 'should invoke mapState every time props are changed if it has zero arguments' , ( ) => {
@@ -562,7 +562,7 @@ describe('React', () => {
562
562
outerComponent . setFoo ( 'BAR' )
563
563
outerComponent . setFoo ( 'BAZ' )
564
564
565
- expect ( invocationCount ) . toEqual ( 4 )
565
+ expect ( invocationCount ) . toEqual ( 3 )
566
566
expect ( propsPassedIn ) . toEqual ( {
567
567
foo : 'BAZ'
568
568
} )
@@ -813,12 +813,12 @@ describe('React', () => {
813
813
div
814
814
)
815
815
816
- expect ( mapStateToPropsCalls ) . toBe ( 2 )
816
+ expect ( mapStateToPropsCalls ) . toBe ( 1 )
817
817
const spy = expect . spyOn ( console , 'error' )
818
818
store . dispatch ( { type : 'APPEND' , body : 'a' } )
819
819
spy . destroy ( )
820
820
expect ( spy . calls . length ) . toBe ( 0 )
821
- expect ( mapStateToPropsCalls ) . toBe ( 2 )
821
+ expect ( mapStateToPropsCalls ) . toBe ( 1 )
822
822
} )
823
823
824
824
it ( 'should shallowly compare the selected state to prevent unnecessary updates' , ( ) => {
@@ -1411,19 +1411,19 @@ describe('React', () => {
1411
1411
</ ProviderMock >
1412
1412
)
1413
1413
1414
- expect ( childMapStateInvokes ) . toBe ( 2 )
1414
+ expect ( childMapStateInvokes ) . toBe ( 1 )
1415
1415
1416
1416
// The store state stays consistent when setState calls are batched
1417
1417
ReactDOM . unstable_batchedUpdates ( ( ) => {
1418
1418
store . dispatch ( { type : 'APPEND' , body : 'c' } )
1419
1419
} )
1420
- expect ( childMapStateInvokes ) . toBe ( 3 )
1420
+ expect ( childMapStateInvokes ) . toBe ( 2 )
1421
1421
1422
1422
// setState calls DOM handlers are batched
1423
1423
const container = TestUtils . findRenderedComponentWithType ( tree , Container )
1424
1424
const node = container . getWrappedInstance ( ) . refs . button
1425
1425
TestUtils . Simulate . click ( node )
1426
- expect ( childMapStateInvokes ) . toBe ( 4 )
1426
+ expect ( childMapStateInvokes ) . toBe ( 3 )
1427
1427
1428
1428
// In future all setState calls will be batched[1]. Uncomment when it
1429
1429
// happens. For now redux-batched-updates middleware can be used as
@@ -1432,7 +1432,7 @@ describe('React', () => {
1432
1432
// [1]: https://twitter.com/sebmarkbage/status/642366976824864768
1433
1433
//
1434
1434
// store.dispatch({ type: 'APPEND', body: 'd' })
1435
- // expect(childMapStateInvokes).toBe(5 )
1435
+ // expect(childMapStateInvokes).toBe(4 )
1436
1436
} )
1437
1437
1438
1438
it ( 'should not render the wrapped component when mapState does not produce change' , ( ) => {
@@ -1458,12 +1458,12 @@ describe('React', () => {
1458
1458
)
1459
1459
1460
1460
expect ( renderCalls ) . toBe ( 1 )
1461
- expect ( mapStateCalls ) . toBe ( 2 )
1461
+ expect ( mapStateCalls ) . toBe ( 1 )
1462
1462
1463
1463
store . dispatch ( { type : 'APPEND' , body : 'a' } )
1464
1464
1465
1465
// After store a change mapState has been called
1466
- expect ( mapStateCalls ) . toBe ( 3 )
1466
+ expect ( mapStateCalls ) . toBe ( 2 )
1467
1467
// But render is not because it did not make any actual changes
1468
1468
expect ( renderCalls ) . toBe ( 1 )
1469
1469
} )
0 commit comments