aboutsummaryrefslogtreecommitdiffstats
path: root/web/src/js/__tests__/ducks/tutils.js
blob: 222404486aac7a11a16083e1029bc305bcc7ac49 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
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(
        combineReducers(parts),
        applyMiddleware(...[thunk])
    )
}

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'
            },
            modal: {
                activeModal: undefined
            },
            optionsEditor: {
                booleanOption: { isUpdating: true, error: false },
                strOption: { error: true },
                intOption: {},
                choiceOption: {},
            }
        },
        settings: {
            contentViews: ['Auto', 'Raw', 'Text'],
            anticache: true,
            anticomp: false
        },
        options: {
            booleanOption: {
                choices: null,
                default: false,
                help: "foo",
                type: "bool",
                value: false
            },
            strOption: {
                choices: null,
                default: null,
                help: "foo",
                type: "str",
                value: "str content"
            },
            intOption: {
                choices: null,
                default: 0,
                help: "foo",
                type: "int",
                value: 1
            },
            choiceOption: {
                choices: ['a', 'b', 'c'],
                default: 'a',
                help: "foo",
                type: "str",
                value: "b"
            },
        },
        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'
            },
            view: [ tflow ]
        },
        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' }
            ]
        }
    })
}