Tests: DRY mockStore()
This commit is contained in:
parent
628d73eb81
commit
23039c353e
2 changed files with 6 additions and 5 deletions
|
@ -1,5 +1,3 @@
|
||||||
import configureMockStore from 'redux-mock-store';
|
|
||||||
import thunk from 'redux-thunk';
|
|
||||||
import {
|
import {
|
||||||
FETCH_ABOUT_PAGE_REQUEST,
|
FETCH_ABOUT_PAGE_REQUEST,
|
||||||
FETCH_ABOUT_PAGE_SUCCESS,
|
FETCH_ABOUT_PAGE_SUCCESS,
|
||||||
|
@ -8,9 +6,7 @@ import {
|
||||||
} from '../about';
|
} from '../about';
|
||||||
import { Map as ImmutableMap } from 'immutable';
|
import { Map as ImmutableMap } from 'immutable';
|
||||||
import { __stub as stubApi } from 'soapbox/api';
|
import { __stub as stubApi } from 'soapbox/api';
|
||||||
|
import { mockStore } from 'soapbox/test_setup';
|
||||||
const middlewares = [thunk];
|
|
||||||
const mockStore = configureMockStore(middlewares);
|
|
||||||
|
|
||||||
describe('fetchAboutPage()', () => {
|
describe('fetchAboutPage()', () => {
|
||||||
it('creates the expected actions on success', () => {
|
it('creates the expected actions on success', () => {
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
|
|
||||||
import { configure } from 'enzyme';
|
import { configure } from 'enzyme';
|
||||||
import Adapter from 'enzyme-adapter-react-16';
|
import Adapter from 'enzyme-adapter-react-16';
|
||||||
|
import thunk from 'redux-thunk';
|
||||||
|
import configureMockStore from 'redux-mock-store';
|
||||||
import { __clear as clearApiMocks } from 'soapbox/api';
|
import { __clear as clearApiMocks } from 'soapbox/api';
|
||||||
|
|
||||||
const adapter = new Adapter();
|
const adapter = new Adapter();
|
||||||
|
@ -9,3 +11,6 @@ configure({ adapter });
|
||||||
|
|
||||||
jest.mock('soapbox/api');
|
jest.mock('soapbox/api');
|
||||||
afterEach(() => clearApiMocks());
|
afterEach(() => clearApiMocks());
|
||||||
|
|
||||||
|
const middlewares = [thunk];
|
||||||
|
export const mockStore = configureMockStore(middlewares);
|
||||||
|
|
Loading…
Reference in a new issue