diff options
author | Maximilian Hils <git@maximilianhils.com> | 2017-05-29 13:42:18 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-05-29 13:42:18 +0200 |
commit | ec7d7c995c0d8e93332b43699ad372f9555c9b75 (patch) | |
tree | 64bcd3790802e537da7d886ebae25e8ff5453d1a /web/src/js/__tests__/ducks/tutils.js | |
parent | e7f7a608c6dda7cc22d2eda1129da99fd2830767 (diff) | |
parent | a0ec6f58e960ba8f41929da971b3603af1c7e629 (diff) | |
download | mitmproxy-ec7d7c995c0d8e93332b43699ad372f9555c9b75.tar.gz mitmproxy-ec7d7c995c0d8e93332b43699ad372f9555c9b75.tar.bz2 mitmproxy-ec7d7c995c0d8e93332b43699ad372f9555c9b75.zip |
Merge pull request #2348 from MatthewShao/jest-dev
[WIP][web] Add tests for js/components/Header
Diffstat (limited to 'web/src/js/__tests__/ducks/tutils.js')
-rw-r--r-- | web/src/js/__tests__/ducks/tutils.js | 62 |
1 files changed, 61 insertions, 1 deletions
diff --git a/web/src/js/__tests__/ducks/tutils.js b/web/src/js/__tests__/ducks/tutils.js index 211b61e3..2a79ede0 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' } + ] + } + }) +} |