@legalplace/wizardx-core 4.42.9 → 4.42.10-nightly.20251125115613
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +376 -1
- package/dist/App.d.ts +1 -6
- package/dist/App.js +2 -7
- package/dist/Loader.d.ts +1 -1
- package/dist/Loader.js +1 -1
- package/dist/PluginLoader.d.ts +21 -36
- package/dist/PluginLoader.js +90 -227
- package/dist/Shimmer.d.ts +8 -11
- package/dist/Shimmer.js +4 -4
- package/dist/ThemeLoader.d.ts +8 -8
- package/dist/WizardCore.d.ts +25 -0
- package/dist/WizardCore.js +119 -0
- package/dist/app.entry.d.ts +2 -0
- package/dist/app.entry.js +1 -0
- package/dist/components/PluginRoute.d.ts +2 -2
- package/dist/components/PluginRoute.js +3 -4
- package/dist/components/SmartScript.d.ts +2 -6
- package/dist/components/SmartScript.js +1 -1
- package/dist/components/UserLocked/UserLockedComponent.js +2 -2
- package/dist/components/View.d.ts +3 -3
- package/dist/components/View.js +5 -7
- package/dist/componentsConnectors/connectBox.d.ts +4 -6
- package/dist/componentsConnectors/connectDocument.d.ts +4 -6
- package/dist/componentsConnectors/connectHeader.d.ts +4 -6
- package/dist/componentsConnectors/connectMetaTitle.d.ts +3 -7
- package/dist/componentsConnectors/connectOption.d.ts +5 -7
- package/dist/componentsConnectors/connectPagination.d.ts +5 -7
- package/dist/componentsConnectors/connectPreview.d.ts +3 -7
- package/dist/componentsConnectors/connectProgress.d.ts +4 -6
- package/dist/componentsConnectors/connectRootOption.d.ts +5 -7
- package/dist/componentsConnectors/connectSection.d.ts +4 -6
- package/dist/componentsConnectors/connectSummary.d.ts +5 -9
- package/dist/componentsConnectors/connectSummaryItem.d.ts +4 -6
- package/dist/componentsConnectors/connectTermsheet.js +1 -1
- package/dist/componentsConnectors/connectVariable.d.ts +6 -8
- package/dist/componentsConnectors/connectWizardWrapper.d.ts +4 -6
- package/dist/componentsConnectors/connector/componentConnector.d.ts +7 -10
- package/dist/componentsConnectors/connector/componentConnector.js +3 -3
- package/dist/componentsConnectors/library.d.ts +47 -81
- package/dist/helpers/activitiesHelper.d.ts +3 -3
- package/dist/helpers/autocomplete.helper.d.ts +2 -2
- package/dist/helpers/autocomplete.helper.js +1 -1
- package/dist/helpers/autosave.helper.d.ts +3 -13
- package/dist/helpers/autosave.helper.js +3 -70
- package/dist/helpers/inpiCitiesHelper.js +1 -1
- package/dist/helpers/outputsParsing.d.ts +9 -9
- package/dist/hooks/useDispatch.d.ts +1 -1
- package/dist/hooks/usePrevious.js +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.js +3 -0
- package/dist/libs/ConditionsRunner.d.ts +1 -1
- package/dist/libs/Formatter/FormatAddress.d.ts +1 -1
- package/dist/libs/InputsInitiator.d.ts +1 -1
- package/dist/libs/PathReader.d.ts +96 -1
- package/dist/libs/PathReader.js +1 -2
- package/dist/libs/SmartScriptStore.d.ts +6 -6
- package/dist/redux/actions/app.d.ts +1 -1
- package/dist/redux/actions/inputs.d.ts +1 -1
- package/dist/redux/actions/library.d.ts +15 -21
- package/dist/redux/actions/references.d.ts +2 -2
- package/dist/redux/actions/sagas/data.d.ts +1 -1
- package/dist/redux/actions/sagas/user.d.ts +1 -1
- package/dist/redux/listeners/subscriber.d.ts +1 -1
- package/dist/redux/middlewares/conditionsWatcherMiddleware.d.ts +1 -1
- package/dist/redux/middlewares/evaluationsWatcherMiddleware.d.ts +1 -1
- package/dist/redux/middlewares/mandatoriesWatcherMiddleware.d.ts +1 -1
- package/dist/redux/middlewares/multiplesActionsMiddleware.d.ts +1 -1
- package/dist/redux/middlewares/paginationWatcherMiddleware.d.ts +2 -2
- package/dist/redux/middlewares/pluginsHookMiddleware.d.ts +1 -2
- package/dist/redux/middlewares/pluginsHookMiddleware.js +1 -7
- package/dist/redux/middlewares/prefillerWatcherMiddleware.d.ts +1 -1
- package/dist/redux/middlewares/smartscriptMiddleware.d.ts +1 -1
- package/dist/redux/middlewares/smartscriptMiddleware.js +2 -2
- package/dist/redux/middlewares/thirdpartyScriptsMiddleware.d.ts +1 -1
- package/dist/redux/reducers/app/pagination/updateAvailableAppStates.js +1 -2
- package/dist/redux/reducers/app.d.ts +6 -6
- package/dist/redux/reducers/references.js +2 -0
- package/dist/redux/selectors/inputs.d.ts +1 -1
- package/dist/redux/selectors/selectors.d.ts +4 -4
- package/dist/redux/store.d.ts +2 -2
- package/dist/routing/adapters/nextjs.adapter.d.ts +3 -0
- package/dist/routing/adapters/nextjs.adapter.js +63 -0
- package/dist/routing/adapters/reactRouter.adapter.d.ts +2 -0
- package/dist/routing/adapters/reactRouter.adapter.js +19 -0
- package/dist/routing/context.d.ts +14 -0
- package/dist/routing/context.js +25 -0
- package/dist/routing/index.d.ts +4 -0
- package/dist/routing/index.js +4 -0
- package/dist/routing/types.d.ts +26 -0
- package/dist/service/api.manager.d.ts +2 -2
- package/dist/service/autocomplete.manager.d.ts +3 -3
- package/dist/service/autocomplete.manager.js +3 -3
- package/dist/tests-misc/plugins/jestTestPlugin/after.js +1 -1
- package/dist/tests-misc/plugins/jestTestPlugin/before.js +1 -1
- package/dist/tests-misc/plugins/jestTestPlugin/title.js +1 -1
- package/dist/tests-misc/themes/jestTestTheme/components/EmailComponent.d.ts +1 -1
- package/dist/tests-misc/themes/jestTestTheme/components/EmailComponent.js +1 -1
- package/dist/tests-misc/themes/jestTestTheme/components/TermsheetComponent.d.ts +1 -1
- package/dist/tests-misc/themes/jestTestTheme/components/TermsheetComponent.js +1 -1
- package/dist/tests-misc/themes/jestTestTheme/components/WizardComponent.d.ts +1 -1
- package/dist/tests-misc/themes/jestTestTheme/components/WizardComponent.js +1 -1
- package/dist/types/Actions.type.d.ts +70 -6
- package/dist/types/Components.type.d.ts +3 -2
- package/dist/types/PluginConfig.type.d.ts +18 -52
- package/dist/types/State.type.d.ts +2 -2
- package/dist/types/config.type.d.ts +1 -1
- package/dist/types/getActions.type.d.ts +1 -1
- package/dist/types/getConnectors.type.d.ts +2 -2
- package/dist/types/getSelectors.type.d.ts +1 -1
- package/dist/wizardcore.entry.d.ts +3 -0
- package/dist/wizardcore.entry.js +2 -0
- package/package.json +40 -17
- package/dist/App.test.js +0 -37
- package/dist/PluginLoader.test.d.ts +0 -1
- package/dist/PluginLoader.test.js +0 -52
- package/dist/ThemeLoader.test.d.ts +0 -2
- package/dist/ThemeLoader.test.js +0 -65
- package/dist/components/View.test.d.ts +0 -2
- package/dist/components/View.test.js +0 -84
- package/dist/componentsConnectors/connectBox.test.d.ts +0 -1
- package/dist/componentsConnectors/connectBox.test.js +0 -218
- package/dist/componentsConnectors/connectDocument.test.d.ts +0 -1
- package/dist/componentsConnectors/connectDocument.test.js +0 -95
- package/dist/componentsConnectors/connectMetaTitle.test.d.ts +0 -1
- package/dist/componentsConnectors/connectMetaTitle.test.js +0 -32
- package/dist/config.test.d.ts +0 -1
- package/dist/config.test.js +0 -54
- package/dist/libs/NumAuto.test.d.ts +0 -1
- package/dist/libs/NumAuto.test.js +0 -43
- package/dist/libs/SectionValidity.test.d.ts +0 -1
- package/dist/libs/SectionValidity.test.js +0 -116
- package/dist/redux/actions/app.test.d.ts +0 -1
- package/dist/redux/actions/app.test.js +0 -90
- package/dist/redux/actions/conditions.test.d.ts +0 -1
- package/dist/redux/actions/conditions.test.js +0 -68
- package/dist/redux/actions/inputs.test.d.ts +0 -1
- package/dist/redux/actions/inputs.test.js +0 -53
- package/dist/redux/actions/references.test.d.ts +0 -1
- package/dist/redux/actions/references.test.js +0 -43
- package/dist/redux/actions/sagas/data.test.d.ts +0 -1
- package/dist/redux/actions/sagas/data.test.js +0 -11
- package/dist/redux/actions/sagas/model.test.d.ts +0 -1
- package/dist/redux/actions/sagas/model.test.js +0 -11
- package/dist/redux/actions/user.test.d.ts +0 -1
- package/dist/redux/actions/user.test.js +0 -16
- package/dist/redux/listeners/subscriber.test.d.ts +0 -1
- package/dist/redux/listeners/subscriber.test.js +0 -31
- package/dist/redux/middlewares/conditionsWatcherMiddleware.test.d.ts +0 -1
- package/dist/redux/middlewares/conditionsWatcherMiddleware.test.js +0 -330
- package/dist/redux/middlewares/evaluationsWatcherMiddleware.test.d.ts +0 -1
- package/dist/redux/middlewares/evaluationsWatcherMiddleware.test.js +0 -242
- package/dist/redux/middlewares/multiplesActionsMiddleware.test.d.ts +0 -1
- package/dist/redux/middlewares/multiplesActionsMiddleware.test.js +0 -209
- package/dist/redux/middlewares/prefillerWatcherMiddleware.test.d.ts +0 -1
- package/dist/redux/middlewares/prefillerWatcherMiddleware.test.js +0 -84
- package/dist/redux/reducers/app/instance.test.d.ts +0 -1
- package/dist/redux/reducers/app/instance.test.js +0 -75
- package/dist/redux/reducers/app/meta.test.d.ts +0 -1
- package/dist/redux/reducers/app/meta.test.js +0 -70
- package/dist/redux/reducers/app/pagination.test.d.ts +0 -1
- package/dist/redux/reducers/app/pagination.test.js +0 -134
- package/dist/redux/reducers/app/wizard.test.d.ts +0 -1
- package/dist/redux/reducers/app/wizard.test.js +0 -53
- package/dist/redux/reducers/app.test.d.ts +0 -1
- package/dist/redux/reducers/app.test.js +0 -175
- package/dist/redux/reducers/conditions/addMultipleOccurency.test.d.ts +0 -1
- package/dist/redux/reducers/conditions/addMultipleOccurency.test.js +0 -108
- package/dist/redux/reducers/conditions/deleteMultipleOccurency.test.d.ts +0 -1
- package/dist/redux/reducers/conditions/deleteMultipleOccurency.test.js +0 -77
- package/dist/redux/reducers/conditions/updateDocumentConditions.test.d.ts +0 -1
- package/dist/redux/reducers/conditions/updateDocumentConditions.test.js +0 -35
- package/dist/redux/reducers/conditions/updateOptionValidatorCondition.test.d.ts +0 -1
- package/dist/redux/reducers/conditions/updateOptionValidatorCondition.test.js +0 -35
- package/dist/redux/reducers/conditions/updateVariableValidatorCondition.test.d.ts +0 -1
- package/dist/redux/reducers/conditions/updateVariableValidatorCondition.test.js +0 -35
- package/dist/redux/reducers/conditions.test.d.ts +0 -1
- package/dist/redux/reducers/conditions.test.js +0 -196
- package/dist/redux/reducers/inputs/addMultipleOccurency.test.d.ts +0 -1
- package/dist/redux/reducers/inputs/addMultipleOccurency.test.js +0 -101
- package/dist/redux/reducers/inputs/deleteMultipleOccurency.test.d.ts +0 -1
- package/dist/redux/reducers/inputs/deleteMultipleOccurency.test.js +0 -56
- package/dist/redux/reducers/inputs.test.d.ts +0 -1
- package/dist/redux/reducers/inputs.test.js +0 -171
- package/dist/redux/reducers/user.test.d.ts +0 -1
- package/dist/redux/reducers/user.test.js +0 -42
- package/dist/redux/routerHistore.test.d.ts +0 -1
- package/dist/redux/routerHistore.test.js +0 -15
- package/dist/redux/sagas/fetchModel.test.d.ts +0 -1
- package/dist/redux/sagas/fetchModel.test.js +0 -127
- package/dist/redux/sagas/runner.test.d.ts +0 -1
- package/dist/redux/sagas/runner.test.js +0 -10
- package/dist/redux/sagas/saveData.test.d.ts +0 -1
- package/dist/redux/sagas/saveData.test.js +0 -74
- package/dist/redux/sagas/setDefaults.test.d.ts +0 -1
- package/dist/redux/sagas/setDefaults.test.js +0 -73
- package/dist/redux/selectors/app.test.d.ts +0 -1
- package/dist/redux/selectors/app.test.js +0 -99
- package/dist/redux/selectors/conditions.test.d.ts +0 -1
- package/dist/redux/selectors/conditions.test.js +0 -70
- package/dist/redux/selectors/inputs.test.d.ts +0 -1
- package/dist/redux/selectors/inputs.test.js +0 -44
- package/dist/redux/selectors/references.test.d.ts +0 -1
- package/dist/redux/selectors/references.test.js +0 -471
- package/dist/redux/selectors/selectors.test.d.ts +0 -1
- package/dist/redux/selectors/selectors.test.js +0 -16
- package/dist/redux/selectors/user.test.d.ts +0 -1
- package/dist/redux/selectors/user.test.js +0 -29
- package/dist/redux/store.test.d.ts +0 -1
- package/dist/redux/store.test.js +0 -16
- /package/dist/{App.test.d.ts → routing/types.js} +0 -0
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import * as fs from 'fs';
|
|
2
|
-
import { ReferencesParser } from '@legalplace/referencesparser';
|
|
3
|
-
import { createAppStore, getStore } from '../store';
|
|
4
|
-
import { initMetaAction, initPaginationAction } from '../actions/app';
|
|
5
|
-
import { initReferencesAction } from '../actions/references';
|
|
6
|
-
import { IntputsInitiator } from '../../libs/InputsInitiator';
|
|
7
|
-
import { initOptionAction, initVariableAction } from '../actions/inputs';
|
|
8
|
-
import { initConditionsAction } from '../actions/conditions';
|
|
9
|
-
import { ConditionsInitiator } from '../../libs/ConditionsInitiator';
|
|
10
|
-
describe('Set defaults saga', () => {
|
|
11
|
-
let store;
|
|
12
|
-
beforeEach(() => {
|
|
13
|
-
createAppStore('memory');
|
|
14
|
-
store = getStore();
|
|
15
|
-
store.dispatch({
|
|
16
|
-
type: 'SET_DEFAULTS',
|
|
17
|
-
});
|
|
18
|
-
const model = JSON.parse(fs.readFileSync('./src/misc/test_models/setDefaults.testmodel.json', 'utf8'));
|
|
19
|
-
const references = new ReferencesParser(model).getReferences();
|
|
20
|
-
store.dispatch(initReferencesAction(references));
|
|
21
|
-
const inputs = new IntputsInitiator(references, null).getInputs();
|
|
22
|
-
Object.keys(inputs.options).forEach((optionId) => {
|
|
23
|
-
const values = inputs.options[optionId];
|
|
24
|
-
store.dispatch(initOptionAction(parseInt(optionId, 10), values));
|
|
25
|
-
});
|
|
26
|
-
Object.keys(inputs.variables).forEach((variableId) => {
|
|
27
|
-
const values = inputs.variables[variableId];
|
|
28
|
-
store.dispatch(initVariableAction(parseInt(variableId, 10), values));
|
|
29
|
-
});
|
|
30
|
-
store.dispatch(initMetaAction({
|
|
31
|
-
id: 123,
|
|
32
|
-
title: 'Test model',
|
|
33
|
-
permalink: 'test-model',
|
|
34
|
-
prefix: '',
|
|
35
|
-
modelVersion: 1,
|
|
36
|
-
productType: 'demarche',
|
|
37
|
-
}));
|
|
38
|
-
store.dispatch(initPaginationAction({
|
|
39
|
-
availableAppStates: ['wizard', 'termsheet'],
|
|
40
|
-
currentAppState: 'wizard',
|
|
41
|
-
currentPage: 4,
|
|
42
|
-
greatestPage: 4,
|
|
43
|
-
currentSectionId: 1,
|
|
44
|
-
availableSections: [1, 3],
|
|
45
|
-
}));
|
|
46
|
-
const conditions = new ConditionsInitiator(references, inputs).getConditions();
|
|
47
|
-
store.dispatch(initConditionsAction(conditions));
|
|
48
|
-
});
|
|
49
|
-
it('Sets defaults properly', () => {
|
|
50
|
-
store.dispatch({ type: 'SET_DEFAULTS' });
|
|
51
|
-
expect(store.getState().app.wizard.availableSections).toStrictEqual([
|
|
52
|
-
1, 2, 3,
|
|
53
|
-
]);
|
|
54
|
-
expect(store.getState().inputs.options).toStrictEqual({
|
|
55
|
-
1: [true],
|
|
56
|
-
2: [true],
|
|
57
|
-
3: [false],
|
|
58
|
-
4: [true],
|
|
59
|
-
5: [true],
|
|
60
|
-
6: [true],
|
|
61
|
-
7: [true],
|
|
62
|
-
8: [true],
|
|
63
|
-
9: [true],
|
|
64
|
-
10: [true],
|
|
65
|
-
11: [false],
|
|
66
|
-
12: [true],
|
|
67
|
-
13: [false],
|
|
68
|
-
14: [true],
|
|
69
|
-
15: [false],
|
|
70
|
-
16: [false],
|
|
71
|
-
});
|
|
72
|
-
});
|
|
73
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
import { createAppStore, getStore } from '../store';
|
|
2
|
-
import { initPaginationAction, initMetaAction, initInstanceAction, } from '../actions/app';
|
|
3
|
-
import { selectCurrentPage, selectCurrentSectionId, selectAvailableSections, selectPermalink, selectDocumentId, selectDocumentTitle, selectInstanceUniqid, selectInstanceIsPaid, } from './app';
|
|
4
|
-
createAppStore('memory');
|
|
5
|
-
const store = getStore();
|
|
6
|
-
describe('App selectors test suit', () => {
|
|
7
|
-
it('Returns current page correctly', () => {
|
|
8
|
-
store.dispatch(initPaginationAction({
|
|
9
|
-
currentSectionId: 1,
|
|
10
|
-
currentPage: 13,
|
|
11
|
-
greatestPage: 1,
|
|
12
|
-
availableSections: [1, 2, 3],
|
|
13
|
-
availableAppStates: ['wizard'],
|
|
14
|
-
currentAppState: 'wizard',
|
|
15
|
-
}));
|
|
16
|
-
const selector = selectCurrentPage();
|
|
17
|
-
expect(selector).toBe(13);
|
|
18
|
-
});
|
|
19
|
-
it('Returns current section id correctly', () => {
|
|
20
|
-
store.dispatch(initPaginationAction({
|
|
21
|
-
currentSectionId: 32,
|
|
22
|
-
currentPage: 13,
|
|
23
|
-
greatestPage: 13,
|
|
24
|
-
availableSections: [1, 2, 3],
|
|
25
|
-
availableAppStates: ['wizard'],
|
|
26
|
-
currentAppState: 'wizard',
|
|
27
|
-
}));
|
|
28
|
-
const selector = selectCurrentSectionId();
|
|
29
|
-
expect(selector).toBe(32);
|
|
30
|
-
});
|
|
31
|
-
it('Returns available sections correctly', () => {
|
|
32
|
-
store.dispatch(initPaginationAction({
|
|
33
|
-
currentSectionId: 32,
|
|
34
|
-
currentPage: 13,
|
|
35
|
-
greatestPage: 13,
|
|
36
|
-
availableSections: [1, 2, 3],
|
|
37
|
-
availableAppStates: ['wizard'],
|
|
38
|
-
currentAppState: 'wizard',
|
|
39
|
-
}));
|
|
40
|
-
const selector = selectAvailableSections();
|
|
41
|
-
expect(selector).toEqual([1, 2, 3]);
|
|
42
|
-
});
|
|
43
|
-
it('Returns permalink correctly', () => {
|
|
44
|
-
store.dispatch(initMetaAction({
|
|
45
|
-
permalink: 'some-permalink',
|
|
46
|
-
title: 'Some title',
|
|
47
|
-
prefix: '',
|
|
48
|
-
id: 123,
|
|
49
|
-
modelVersion: 1,
|
|
50
|
-
productType: 'demarche',
|
|
51
|
-
}));
|
|
52
|
-
const selector = selectPermalink();
|
|
53
|
-
expect(selector).toBe('some-permalink');
|
|
54
|
-
});
|
|
55
|
-
it('Returns document id correctly', () => {
|
|
56
|
-
store.dispatch(initMetaAction({
|
|
57
|
-
permalink: 'some-permalink',
|
|
58
|
-
title: 'Some title',
|
|
59
|
-
prefix: '',
|
|
60
|
-
id: 123,
|
|
61
|
-
modelVersion: 1,
|
|
62
|
-
productType: 'demarche',
|
|
63
|
-
}));
|
|
64
|
-
const selector = selectDocumentId();
|
|
65
|
-
expect(selector).toBe(123);
|
|
66
|
-
});
|
|
67
|
-
it('Returns document title correctly', () => {
|
|
68
|
-
store.dispatch(initMetaAction({
|
|
69
|
-
permalink: 'some-permalink',
|
|
70
|
-
title: 'Some title',
|
|
71
|
-
prefix: '',
|
|
72
|
-
id: 123,
|
|
73
|
-
modelVersion: 1,
|
|
74
|
-
productType: 'demarche',
|
|
75
|
-
}));
|
|
76
|
-
const selector = selectDocumentTitle();
|
|
77
|
-
expect(selector).toBe('Some title');
|
|
78
|
-
});
|
|
79
|
-
it('Returns instance uniqid correctly', () => {
|
|
80
|
-
store.dispatch(initInstanceAction({
|
|
81
|
-
dataStatus: 'saved',
|
|
82
|
-
uniqid: 'SomeUNiqID',
|
|
83
|
-
isPaid: false,
|
|
84
|
-
steps: '*',
|
|
85
|
-
}));
|
|
86
|
-
const selector = selectInstanceUniqid();
|
|
87
|
-
expect(selector).toBe('SomeUNiqID');
|
|
88
|
-
});
|
|
89
|
-
it('Returns instance isPaid correctly', () => {
|
|
90
|
-
store.dispatch(initInstanceAction({
|
|
91
|
-
dataStatus: 'saved',
|
|
92
|
-
uniqid: 'SomeUNiqID',
|
|
93
|
-
isPaid: true,
|
|
94
|
-
steps: '*',
|
|
95
|
-
}));
|
|
96
|
-
const selector = selectInstanceIsPaid();
|
|
97
|
-
expect(selector).toBeTruthy();
|
|
98
|
-
});
|
|
99
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import { createAppStore, getStore } from '../store';
|
|
2
|
-
import { initConditionsAction } from '../actions/conditions';
|
|
3
|
-
import { selectOptionConditionValue, selectVariableConditionValue, selectSectionConditionValue, selectPrefillerConditionValue, selectOptionValidatorConditionValue, selectVariableValidatorConditionValue, } from './conditions';
|
|
4
|
-
createAppStore('memory');
|
|
5
|
-
const store = getStore();
|
|
6
|
-
store.dispatch(initConditionsAction({
|
|
7
|
-
options: {
|
|
8
|
-
34: [false, true],
|
|
9
|
-
},
|
|
10
|
-
variables: {
|
|
11
|
-
33: [false, true],
|
|
12
|
-
},
|
|
13
|
-
prefillers: {
|
|
14
|
-
53: [[false], [true]],
|
|
15
|
-
},
|
|
16
|
-
sections: {
|
|
17
|
-
main: {
|
|
18
|
-
31: false,
|
|
19
|
-
},
|
|
20
|
-
},
|
|
21
|
-
documents: {
|
|
22
|
-
main: true,
|
|
23
|
-
},
|
|
24
|
-
validators: {
|
|
25
|
-
options: {
|
|
26
|
-
234: [false],
|
|
27
|
-
},
|
|
28
|
-
variables: {
|
|
29
|
-
124: [true],
|
|
30
|
-
},
|
|
31
|
-
},
|
|
32
|
-
}));
|
|
33
|
-
describe('Conditions selectors test suit', () => {
|
|
34
|
-
it('Selects option conditions correctly (all occurencies)', () => {
|
|
35
|
-
const condition = selectOptionConditionValue(34);
|
|
36
|
-
expect(condition).toEqual([false, true]);
|
|
37
|
-
});
|
|
38
|
-
it('Selects option conditions correctly (specific occurency)', () => {
|
|
39
|
-
const condition = selectOptionConditionValue(34, 1);
|
|
40
|
-
expect(condition).toBeTruthy();
|
|
41
|
-
});
|
|
42
|
-
it('Selects variable conditions correctly (all occurencies)', () => {
|
|
43
|
-
const condition = selectVariableConditionValue(33);
|
|
44
|
-
expect(condition).toEqual([false, true]);
|
|
45
|
-
});
|
|
46
|
-
it('Selects variable conditions correctly (specific occurency)', () => {
|
|
47
|
-
const condition = selectVariableConditionValue(33, 1);
|
|
48
|
-
expect(condition).toBeTruthy();
|
|
49
|
-
});
|
|
50
|
-
it('Selects section conditions correctly ', () => {
|
|
51
|
-
const condition = selectSectionConditionValue(31);
|
|
52
|
-
expect(condition).toBeFalsy();
|
|
53
|
-
});
|
|
54
|
-
it('Selects prefiller conditions correctly (all occurencies)', () => {
|
|
55
|
-
const condition = selectPrefillerConditionValue(53);
|
|
56
|
-
expect(condition).toEqual([[false], [true]]);
|
|
57
|
-
});
|
|
58
|
-
it('Selects prefiller conditions correctly (specific occurency)', () => {
|
|
59
|
-
const condition = selectPrefillerConditionValue(53, 1);
|
|
60
|
-
expect(condition).toEqual([true]);
|
|
61
|
-
});
|
|
62
|
-
it('Selects option validator conditions correctly', () => {
|
|
63
|
-
const condition = selectOptionValidatorConditionValue(234);
|
|
64
|
-
expect(condition).toEqual([false]);
|
|
65
|
-
});
|
|
66
|
-
it('Selects variable validator conditions correctly', () => {
|
|
67
|
-
const condition = selectVariableValidatorConditionValue(124);
|
|
68
|
-
expect(condition).toEqual([true]);
|
|
69
|
-
});
|
|
70
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { createAppStore, getStore } from '../store';
|
|
2
|
-
import { selectOptionInput, selectVariableInput, selectVariableInputByIndex, selectOptionInputByIndex, selectInputs, } from './inputs';
|
|
3
|
-
import { initOptionAction, initVariableAction } from '../actions/inputs';
|
|
4
|
-
createAppStore('memory');
|
|
5
|
-
const store = getStore();
|
|
6
|
-
describe('Inputs selectors test suit', () => {
|
|
7
|
-
it('Returns Inputs Object properly', () => {
|
|
8
|
-
store.dispatch(initOptionAction(4, [false, true]));
|
|
9
|
-
store.dispatch(initOptionAction(5, [true]));
|
|
10
|
-
store.dispatch(initVariableAction(51, ['Ok', 'Hello']));
|
|
11
|
-
expect(selectInputs()).toEqual({
|
|
12
|
-
options: {
|
|
13
|
-
4: [false, true],
|
|
14
|
-
5: [true],
|
|
15
|
-
},
|
|
16
|
-
variables: {
|
|
17
|
-
51: ['Ok', 'Hello'],
|
|
18
|
-
},
|
|
19
|
-
});
|
|
20
|
-
});
|
|
21
|
-
it('Returns current option input (all occurencies)', () => {
|
|
22
|
-
store.dispatch(initOptionAction(4, [false, true]));
|
|
23
|
-
const selector = selectOptionInput(4);
|
|
24
|
-
expect(selector).toEqual([false, true]);
|
|
25
|
-
});
|
|
26
|
-
it('Returns current option input (one occurency)', () => {
|
|
27
|
-
store.dispatch(initOptionAction(4, [false, true]));
|
|
28
|
-
const selector = selectOptionInputByIndex(4, 1);
|
|
29
|
-
expect(selector).toBeTruthy();
|
|
30
|
-
});
|
|
31
|
-
it('Returns undefined if option does not exist (one occurency)', () => {
|
|
32
|
-
expect(selectOptionInputByIndex(44, 1)).toBeUndefined();
|
|
33
|
-
});
|
|
34
|
-
it('Returns current variable input (all occurencies)', () => {
|
|
35
|
-
store.dispatch(initVariableAction(4, ['Hello', 'World']));
|
|
36
|
-
const selector = selectVariableInput(4);
|
|
37
|
-
expect(selector).toEqual(['Hello', 'World']);
|
|
38
|
-
});
|
|
39
|
-
it('Returns current variable input (one occurency)', () => {
|
|
40
|
-
store.dispatch(initVariableAction(4, ['Hello', 'World']));
|
|
41
|
-
const selector = selectVariableInputByIndex(4, 1);
|
|
42
|
-
expect(selector).toBe('World');
|
|
43
|
-
});
|
|
44
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|