mirror of
https://github.com/empayre/fleet.git
synced 2024-11-06 17:05:18 +00:00
b638ae186d
* API client utility * moves test helpers to the test directory * Utility to namespace local storage keys * LoginSuccessfulPage component * Check icon * adds auth to redux state * successful form submission * Allow tests to load dummy SVG static images & test fixes
31 lines
707 B
JavaScript
31 lines
707 B
JavaScript
import React from 'react';
|
|
import configureStore from 'redux-mock-store';
|
|
import { Provider } from 'react-redux';
|
|
import thunk from 'redux-thunk';
|
|
|
|
export const fillInFormInput = (inputComponent, value) => {
|
|
return inputComponent.simulate('change', { target: { value } });
|
|
};
|
|
|
|
export const reduxMockStore = (store = {}) => {
|
|
const middlewares = [thunk];
|
|
const mockStore = configureStore(middlewares);
|
|
|
|
return mockStore(store);
|
|
};
|
|
|
|
export const connectedComponent = (ComponentClass, { props = {}, mockStore }) => {
|
|
return (
|
|
<Provider store={mockStore}>
|
|
<ComponentClass {...props} />
|
|
</Provider>
|
|
);
|
|
};
|
|
|
|
export default {
|
|
connectedComponent,
|
|
fillInFormInput,
|
|
reduxMockStore,
|
|
};
|
|
|