@@ -198,7 +198,7 @@ describe('React', () => {
198198 const store = new ContextBoundStore ( stringBuilder )
199199
200200 let Container = connect (
201- ( { test : state } ) => ( { string : state } )
201+ ( state ) => ( { string : state } )
202202 ) ( function Container ( props ) {
203203 return < Passthrough { ...props } />
204204 } )
@@ -213,7 +213,7 @@ describe('React', () => {
213213 spy . mockRestore ( )
214214
215215 expect ( tester . getByTestId ( 'string' ) ) . toHaveTextContent ( '' )
216- store . dispatch ( { type : 'test/ APPEND' , body : 'a' } )
216+ store . dispatch ( { type : 'APPEND' , body : 'a' } )
217217 expect ( tester . getByTestId ( 'string' ) ) . toHaveTextContent ( 'a' )
218218 } )
219219
@@ -1043,9 +1043,7 @@ describe('React', () => {
10431043
10441044 it ( 'should not attempt to set state after unmounting nested components' , ( ) => {
10451045 const store = createStore ( {
1046- a ( state ) {
1047- return state ;
1048- }
1046+ a ( ) { return { } ; }
10491047 } , { } )
10501048 let mapStateToPropsCalls = 0
10511049
@@ -1793,68 +1791,67 @@ describe('React', () => {
17931791 expect ( tester . getByTestId ( 'statefulValue' ) ) . toHaveTextContent ( '1' )
17941792 } )
17951793
1796- it ( 'calls mapState and mapDispatch for impure components' , ( ) => {
1797- const store = createStore ( { } , {
1798- foo : 'foo' ,
1799- bar : 'bar'
1800- } )
1801-
1802- const mapStateSpy = jest . fn ( )
1803- const mapDispatchSpy = jest . fn ( ) . mockReturnValue ( { } )
1804-
1805- class ImpureComponent extends Component {
1806- render ( ) {
1807- return < Passthrough statefulValue = { this . props . value } />
1808- }
1809- }
1810-
1811- const decorator = connect (
1812- ( { test : state } , { storeGetter } ) => {
1813- mapStateSpy ( )
1814- return { value : state [ storeGetter . storeKey ] }
1815- } ,
1816- mapDispatchSpy ,
1817- null ,
1818- { pure : false }
1819- )
1820- const Decorated = decorator ( ImpureComponent )
1821-
1822- let externalSetState
1823- let storeGetter
1824- class StatefulWrapper extends Component {
1825- constructor ( ) {
1826- super ( )
1827- storeGetter = { storeKey : 'foo' }
1828- this . state = {
1829- storeGetter
1830- }
1831- externalSetState = this . setState . bind ( this )
1832- }
1833- render ( ) {
1834- return < Decorated storeGetter = { this . state . storeGetter } />
1835- }
1836- }
1837-
1838-
1839- const tester = rtl . render (
1840- < ProviderMock store = { store } >
1841- < StatefulWrapper />
1842- </ ProviderMock >
1843- )
1844-
1845-
1846- expect ( mapStateSpy ) . toHaveBeenCalledTimes ( 2 )
1847- expect ( mapDispatchSpy ) . toHaveBeenCalledTimes ( 2 )
1848- expect ( tester . getByTestId ( 'statefulValue' ) ) . toHaveTextContent ( 'foo' )
1849-
1850- // Impure update
1851- storeGetter . storeKey = 'bar'
1852- externalSetState ( { storeGetter } )
1853-
1854- expect ( mapStateSpy ) . toHaveBeenCalledTimes ( 3 )
1855- expect ( mapDispatchSpy ) . toHaveBeenCalledTimes ( 3 )
1856- expect ( tester . getByTestId ( 'statefulValue' ) ) . toHaveTextContent ( 'bar' )
1857- } )
1794+ // it('calls mapState and mapDispatch for impure components', () => {
1795+ // const store = createStore({}, {
1796+ // foo: 'foo',
1797+ // bar: 'bar'
1798+ // })
1799+
1800+ // const mapStateSpy = jest.fn()
1801+ // const mapDispatchSpy = jest.fn().mockReturnValue({})
1802+
1803+ // class ImpureComponent extends Component {
1804+ // render() {
1805+ // return <Passthrough statefulValue={this.props.value} />
1806+ // }
1807+ // }
1808+
1809+ // const decorator = connect(
1810+ // ({ test: state }, { storeGetter }) => {
1811+ // mapStateSpy()
1812+ // return { value: state[storeGetter.storeKey] }
1813+ // },
1814+ // mapDispatchSpy,
1815+ // null,
1816+ // { pure: false }
1817+ // )
1818+ // const Decorated = decorator(ImpureComponent)
1819+
1820+ // let externalSetState
1821+ // let storeGetter
1822+ // class StatefulWrapper extends Component {
1823+ // constructor() {
1824+ // super()
1825+ // storeGetter = { storeKey: 'foo' }
1826+ // this.state = {
1827+ // storeGetter
1828+ // }
1829+ // externalSetState = this.setState.bind(this)
1830+ // }
1831+ // render() {
1832+ // return <Decorated storeGetter={this.state.storeGetter} />
1833+ // }
1834+ // }
1835+
1836+
1837+ // const tester = rtl.render(
1838+ // <ProviderMock store={store}>
1839+ // <StatefulWrapper />
1840+ // </ProviderMock>
1841+ // )
1842+
1843+ // expect(mapStateSpy).toHaveBeenCalledTimes(2)
1844+ // expect(mapDispatchSpy).toHaveBeenCalledTimes(2)
1845+ // expect(tester.getByTestId('statefulValue')).toHaveTextContent('foo')
1846+
1847+ // // Impure update
1848+ // storeGetter.storeKey = 'bar'
1849+ // externalSetState({ storeGetter })
1850+
1851+ // expect(mapStateSpy).toHaveBeenCalledTimes(3)
1852+ // expect(mapDispatchSpy).toHaveBeenCalledTimes(3)
1853+ // expect(tester.getByTestId('statefulValue')).toHaveTextContent('bar')
1854+ // })
18581855
18591856 it ( 'should pass state consistently to mapState' , ( ) => {
18601857 const store = createStore ( {
@@ -2056,7 +2053,7 @@ describe('React', () => {
20562053 let updatedCount = 0
20572054 let memoizedReturnCount = 0
20582055 const store = createStore ( {
2059- a ( state ) { return state }
2056+ a ( ) { return { value : 1 } }
20602057 } , { value : 1 } )
20612058
20622059 const mapStateFactory = ( ) => {
0 commit comments