Sha256: a3c341fa095cadbf6da7f3ebb32aa92d350182ca1f94ea5a764c2975d8823ea6
Contents?: true
Size: 1.15 KB
Versions: 31
Compression:
Stored size: 1.15 KB
Contents
import axios from 'axios'; import MockAdapter from 'axios-mock-adapter'; import configureMockStore from 'redux-mock-store'; import thunk from 'redux-thunk'; import Immutable from 'seamless-immutable'; import { successResponse, getSuccessActions, getFailureActions, } from './settings.fixtures'; import { loadSetting } from '../SettingsActions'; const mockStore = configureMockStore([thunk]); const store = mockStore({ subscriptions: Immutable({}) }); const mockApi = new MockAdapter(axios); afterEach(() => { store.clearActions(); mockApi.reset(); }); describe('load setting actions ', () => { const url = '/api/v2/settings/test_setting'; describe('creates GET_SETTING_REQUEST', () => { it('and then fails with 422', () => { mockApi.onGet(url).reply(422); return store.dispatch(loadSetting('test_setting')) .then(() => expect(store.getActions()).toEqual(getFailureActions)); }); it('and ends with success', () => { mockApi.onGet(url).reply(200, successResponse); return store.dispatch(loadSetting('test_setting')) .then(() => expect(store.getActions()).toEqual(getSuccessActions)); }); }); });
Version data entries
31 entries across 31 versions & 1 rubygems