fleet/frontend/test/helpers.jsx
Mike Stone b638ae186d Login page form submission (#157)
* 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
2016-09-13 22:43:26 -07:00

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,
};