@@ -103,6 +103,7 @@ describe('React', () => {
103
103
const store = createStore ( ( ) => ( { hi : 'there' } ) )
104
104
105
105
const Container = React . memo ( props => < Passthrough { ...props } /> ) // eslint-disable-line
106
+ Container . displayName = 'Container'
106
107
const WrappedContainer = connect ( state => state ) ( Container )
107
108
108
109
const tester = rtl . render (
@@ -137,6 +138,7 @@ describe('React', () => {
137
138
< Container pass = "through" baz = { 50 } />
138
139
</ ProviderMock >
139
140
)
141
+
140
142
expect ( tester . getByTestId ( 'pass' ) ) . toHaveTextContent ( 'through' )
141
143
expect ( tester . getByTestId ( 'foo' ) ) . toHaveTextContent ( 'bar' )
142
144
expect ( tester . getByTestId ( 'baz' ) ) . toHaveTextContent ( '42' )
@@ -1610,6 +1612,32 @@ describe('React', () => {
1610
1612
expect ( actualState ) . toEqual ( expectedState )
1611
1613
} )
1612
1614
1615
+ it ( 'should use the store from the props instead of from the context if present' , ( ) => {
1616
+ class Container extends Component {
1617
+ render ( ) {
1618
+ return < Passthrough />
1619
+ }
1620
+ }
1621
+
1622
+ let actualState
1623
+
1624
+ const expectedState = { foos : { } }
1625
+ const decorator = connect ( state => {
1626
+ actualState = state
1627
+ return { }
1628
+ } )
1629
+ const Decorated = decorator ( Container )
1630
+ const mockStore = {
1631
+ dispatch : ( ) => { } ,
1632
+ subscribe : ( ) => { } ,
1633
+ getState : ( ) => expectedState
1634
+ }
1635
+
1636
+ rtl . render ( < Decorated store = { mockStore } /> )
1637
+
1638
+ expect ( actualState ) . toEqual ( expectedState )
1639
+ } )
1640
+
1613
1641
it ( 'should use a custom context provider and consumer if passed as a prop to the component' , ( ) => {
1614
1642
class Container extends Component {
1615
1643
render ( ) {
0 commit comments