diff --git a/squarenotsquare/__tests__/Action-Creators-test.js b/squarenotsquare/__tests__/Action-Creators-test.js new file mode 100644 index 0000000..7faca6e --- /dev/null +++ b/squarenotsquare/__tests__/Action-Creators-test.js @@ -0,0 +1,19 @@ +import 'react-native'; +import initStore from '../src/redux/CreateStore'; +import {appInit} from '../src/redux/actions/SystemActions'; +import { APP_INIT } from '../src/redux/types/SystemTypes'; +import configureMockStore from 'redux-mock-store'; +import thunk from 'redux-thunk'; + +const flushPromises = () => new Promise(setImmediate); +const middlewares = [thunk]; +const mockStore = configureMockStore(middlewares); + +test('starts redux store', () => { + const localStore = mockStore(); + return localStore.dispatch(appInit()) + .then( () => { + const actualAction = localStore.getActions()[0]; + expect(actualAction.type).toEqual(APP_INIT); + }) +}); \ No newline at end of file diff --git a/squarenotsquare/__tests__/Redux-test.js b/squarenotsquare/__tests__/Redux-test.js deleted file mode 100644 index 9b1a922..0000000 --- a/squarenotsquare/__tests__/Redux-test.js +++ /dev/null @@ -1,16 +0,0 @@ -import 'react-native'; -import React from 'react'; -import initStore from '../src/redux/CreateStore'; -import appInit from '../src/redux/actions/SystemActions'; -import { APP_INIT } from '../src/edux/types/SystemTypes'; - -const flushPromises = () => new Promise(setImmediate); - -test('starts redux store', () => { - const reduxStore = initStore(); - reduxStore.dispatch(appInit()) - .then(() => { - const actualActions = reduxStore.getActions().map(action = action.type); - expect(actualActions).to.eql(APP_INIT); - }); -}); \ No newline at end of file