Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it('should accept factories that get invoked with props', () => {
let reducedActions = [];
let reducer = (state, action) => {
reducedActions.push(action);
return state;
};
let store = createStore(reducer, applyMiddleware(reduxObservable()));
@dispatchOnMount(
(props) => ({ type: 'PLAIN_ACTION', value: props.value }),
(props) => () => Observable.of({ type: 'SOURCE2', value: props.value }))
class TestComponent extends Component {
}
let comp = new TestComponent({ value: 'Bilbo Bagginses' });
// fake connection?
comp.context = { store };
comp.componentDidMount();
expect(reducedActions).to.deep.equal([
{ type: '@@redux/INIT' },
{ type: 'PLAIN_ACTION', value: 'Bilbo Bagginses' },
{ type: 'SOURCE2', value: 'Bilbo Bagginses' }
const ctreateStoreWithReduxObservableMiddleware = (services) => {
const reducer = (state = [], action) => state
.concat(action)
.filter(({ type }) => ['@@redux/INIT', FETCH_DATA, FETCH_CLEAR_CACHE].indexOf(type) === -1);
// create Processor
const processor = combineDelegators(
createFetchProcess(services)
);
const middleware = reduxObservable(processor);
const store = createStore(reducer, applyMiddleware(middleware));
return store;
};