hoc-redux-connector
Version:
A React High-Order Component to simplify the usage of mapStateToProps and mapDispatchToProps of react-redux
28 lines (23 loc) • 541 B
JavaScript
import { setMapStateToProps } from '../src/index';
const stateMock = {
firstReducer: {
text: 'Bonjour',
deeperObject: {
text: 'DeeperBonjour',
},
},
secondReducer: {
text: 'Aurevoir',
},
};
test('Unit test setMapStateToProps', () => {
const inputMock = {
text: 'firstReducer.text',
theDeeperText: 'firstReducer.deeperObject.text',
};
const outputMock = {
text: 'Bonjour',
theDeeperText: 'DeeperBonjour',
};
expect(setMapStateToProps(inputMock)(stateMock)).toEqual(outputMock);
});