diff --git a/web/src/js/__tests__/components/FlowTable/FlowTableHeadSpec.js b/web/src/js/__tests__/components/FlowTable/FlowTableHeadSpec.js index 51ff4ceb2..3b7302f22 100644 --- a/web/src/js/__tests__/components/FlowTable/FlowTableHeadSpec.js +++ b/web/src/js/__tests__/components/FlowTable/FlowTableHeadSpec.js @@ -2,9 +2,8 @@ import React from 'react' import renderer from 'react-test-renderer' import ConnectedHead, { FlowTableHead } from '../../../components/FlowTable/FlowTableHead' import { Provider } from 'react-redux' -import configureStore from 'redux-mock-store' +import { TStore } from '../../ducks/tutils' -const mockStore = configureStore() describe('FlowTableHead Component', () => { let sortFn = jest.fn(), @@ -21,7 +20,7 @@ describe('FlowTableHead Component', () => { }) it('should connect to state', () => { - let store = mockStore({ flows: {sort: {desc: true, column: 'PathColumn'}} }), + let store = TStore(), provider = renderer.create( diff --git a/web/src/js/__tests__/components/Header/ConnectionIndicatorSpec.js b/web/src/js/__tests__/components/Header/ConnectionIndicatorSpec.js index 88527d915..45fcb5e40 100644 --- a/web/src/js/__tests__/components/Header/ConnectionIndicatorSpec.js +++ b/web/src/js/__tests__/components/Header/ConnectionIndicatorSpec.js @@ -3,9 +3,7 @@ import renderer from 'react-test-renderer' import ConnectedIndicator, { ConnectionIndicator } from '../../../components/Header/ConnectionIndicator' import { ConnectionState } from '../../../ducks/connection' import { Provider } from 'react-redux' -import configureStore from 'redux-mock-store' - -const mockStore = configureStore() +import { TStore } from '../../ducks/tutils' describe('ConnectionIndicator Component', () => { @@ -45,7 +43,7 @@ describe('ConnectionIndicator Component', () => { }) it('should connect to state', () => { - let store = mockStore({ connection: {state: ConnectionState.INIT} }), + let store = TStore(), provider = renderer.create( diff --git a/web/src/js/__tests__/ducks/tutils.js b/web/src/js/__tests__/ducks/tutils.js index 211b61e3b..2a79ede01 100644 --- a/web/src/js/__tests__/ducks/tutils.js +++ b/web/src/js/__tests__/ducks/tutils.js @@ -1,5 +1,11 @@ +import React from 'react' import { combineReducers, applyMiddleware, createStore as createReduxStore } from 'redux' import thunk from 'redux-thunk' +import configureStore from 'redux-mock-store' +import { ConnectionState } from '../../ducks/connection' +import TFlow from './_tflow' + +const mockStore = configureStore([thunk]) export function createStore(parts) { return createReduxStore( @@ -8,4 +14,58 @@ export function createStore(parts) { ) } -export { default as TFlow } from './_tflow' +export { TFlow } + +export function TStore(){ + let tflow = new TFlow() + return mockStore({ + ui: { + flow: { + contentView: 'Auto', + displayLarge: false, + showFullContent: true, + maxContentLines: 10, + content: ['foo', 'bar'], + viewDescription: 'foo', + modifiedFlow: true, + tab: 'request' + }, + header: { + tab: 'Start' + } + }, + settings: { + contentViews: ['Auto', 'Raw', 'Text'], + anticache: true, + anticomp: false + }, + flows: { + selected: ["d91165be-ca1f-4612-88a9-c0f8696f3e29"], + byId: {"d91165be-ca1f-4612-88a9-c0f8696f3e29": tflow}, + filter: '~u foo', + highlight: '~a bar', + sort: { + desc: true, + column: 'PathColumn' + } + }, + connection: { + state: ConnectionState.ESTABLISHED + + }, + eventLog: { + visible: true, + filters: { + debug: true, + info: true, + web: false, + warn: true, + error: true + }, + view: [ + { id: 1, level: 'info', message: 'foo' }, + { id: 2, level: 'error', message: 'bar' } + ] + } + }) +}