@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,43 +0,0 @@
|
|
|
1
|
-
import { NumAuto } from './NumAuto';
|
|
2
|
-
describe('NumAuto Test Suit', () => {
|
|
3
|
-
it('Resets properly', () => {
|
|
4
|
-
expect(NumAuto.getNum('myTestIndex', null)).toEqual(1);
|
|
5
|
-
expect(NumAuto.getNum('myTestIndex', null)).toEqual(2);
|
|
6
|
-
expect(NumAuto.getNum('myTestIndex', null)).toEqual(3);
|
|
7
|
-
NumAuto.resetNums();
|
|
8
|
-
expect(NumAuto.getNum('myTestIndex', null)).toEqual(1);
|
|
9
|
-
NumAuto.resetNums();
|
|
10
|
-
});
|
|
11
|
-
it('It increments indexes correctly', () => {
|
|
12
|
-
NumAuto.resetNums();
|
|
13
|
-
expect(NumAuto.getNum('myTestIndex', null)).toEqual(1);
|
|
14
|
-
expect(NumAuto.getNum('myTestIndex', null)).toEqual(2);
|
|
15
|
-
expect(NumAuto.getNum('myOtherTestIndex', null)).toEqual(1);
|
|
16
|
-
expect(NumAuto.getNum('myTestIndex', null)).toEqual(3);
|
|
17
|
-
expect(NumAuto.getNum('myOtherTestIndex', null)).toEqual(2);
|
|
18
|
-
});
|
|
19
|
-
it('It tags properly', () => {
|
|
20
|
-
NumAuto.resetNums();
|
|
21
|
-
expect(NumAuto.getNum('myTestIndex', null)).toEqual(1);
|
|
22
|
-
expect(NumAuto.getNum('myTestIndex', 'myTestTag')).toEqual(2);
|
|
23
|
-
expect(NumAuto.getNum('myTestIndex', null)).toEqual(3);
|
|
24
|
-
expect(NumAuto.getNumPre('myTestTag', 0, 0)).toEqual(2);
|
|
25
|
-
expect(NumAuto.getNum('myTestTag', null)).toEqual(2);
|
|
26
|
-
});
|
|
27
|
-
it('It returns previous indexes correctly', () => {
|
|
28
|
-
NumAuto.resetNums();
|
|
29
|
-
expect(NumAuto.getNum('myTestIndex', null)).toEqual(1);
|
|
30
|
-
expect(NumAuto.getNum('myTestIndex', null)).toEqual(2);
|
|
31
|
-
expect(NumAuto.getNum('myOtherTestIndex', null)).toEqual(1);
|
|
32
|
-
expect(NumAuto.getNum('myTestIndex', null)).toEqual(3);
|
|
33
|
-
expect(NumAuto.getNum('myOtherTestIndex', null)).toEqual(2);
|
|
34
|
-
expect(NumAuto.getNumPre('myTestIndex', 0, 1)).toEqual(3);
|
|
35
|
-
expect(NumAuto.getNumPre('myOtherTestIndex', 0, 0)).toEqual(2);
|
|
36
|
-
expect(NumAuto.getNum('myTestIndex', null)).toEqual(4);
|
|
37
|
-
expect(NumAuto.getNum('myOtherTestIndex', null)).toEqual(3);
|
|
38
|
-
expect(NumAuto.getNum('myOtherTestIndex', null)).toEqual(4);
|
|
39
|
-
expect(NumAuto.getNum('myOtherTestIndex', null)).toEqual(5);
|
|
40
|
-
expect(NumAuto.getNumPre('myTestIndex', 0, 0)).toEqual(4);
|
|
41
|
-
expect(NumAuto.getNumPre('myOtherTestIndex', 0, 1)).toEqual(5);
|
|
42
|
-
});
|
|
43
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
import { SectionValidity } from './SectionValidity';
|
|
2
|
-
const mockInputs = {
|
|
3
|
-
options: {
|
|
4
|
-
1: [true],
|
|
5
|
-
2: [true],
|
|
6
|
-
3: [true],
|
|
7
|
-
1032: [true],
|
|
8
|
-
},
|
|
9
|
-
variables: {},
|
|
10
|
-
};
|
|
11
|
-
const mockReferences = {
|
|
12
|
-
sections: {
|
|
13
|
-
main: {
|
|
14
|
-
1: {
|
|
15
|
-
id: 1,
|
|
16
|
-
label: 'Section 1 - Valid Section',
|
|
17
|
-
options: [1],
|
|
18
|
-
},
|
|
19
|
-
2: {
|
|
20
|
-
id: 2,
|
|
21
|
-
label: 'Section 2 - Unvalid Section',
|
|
22
|
-
options: [2],
|
|
23
|
-
},
|
|
24
|
-
3: {
|
|
25
|
-
id: 3,
|
|
26
|
-
label: 'Section 3 - Has inexistant child',
|
|
27
|
-
options: [1032],
|
|
28
|
-
},
|
|
29
|
-
},
|
|
30
|
-
},
|
|
31
|
-
options: {
|
|
32
|
-
1: {
|
|
33
|
-
meta: {
|
|
34
|
-
type: 'checkbox',
|
|
35
|
-
id: 1,
|
|
36
|
-
label: 'Option 1',
|
|
37
|
-
step: '*',
|
|
38
|
-
},
|
|
39
|
-
options: [],
|
|
40
|
-
variables: [1],
|
|
41
|
-
},
|
|
42
|
-
2: {
|
|
43
|
-
meta: {
|
|
44
|
-
type: 'checkbox',
|
|
45
|
-
id: 2,
|
|
46
|
-
label: 'Option 2',
|
|
47
|
-
step: '*',
|
|
48
|
-
},
|
|
49
|
-
options: [3],
|
|
50
|
-
variables: [2],
|
|
51
|
-
},
|
|
52
|
-
3: {
|
|
53
|
-
meta: {
|
|
54
|
-
type: 'checkbox',
|
|
55
|
-
id: 3,
|
|
56
|
-
label: 'Option 3',
|
|
57
|
-
step: '*',
|
|
58
|
-
},
|
|
59
|
-
options: [],
|
|
60
|
-
variables: [],
|
|
61
|
-
},
|
|
62
|
-
},
|
|
63
|
-
};
|
|
64
|
-
const mockConditions = {
|
|
65
|
-
options: {
|
|
66
|
-
1: [true],
|
|
67
|
-
2: [true],
|
|
68
|
-
3: [true],
|
|
69
|
-
},
|
|
70
|
-
variables: {
|
|
71
|
-
1: [true],
|
|
72
|
-
2: [true],
|
|
73
|
-
},
|
|
74
|
-
validators: {
|
|
75
|
-
options: {
|
|
76
|
-
1: [true],
|
|
77
|
-
2: [true],
|
|
78
|
-
3: [false],
|
|
79
|
-
},
|
|
80
|
-
variables: {
|
|
81
|
-
1: [true],
|
|
82
|
-
2: [false],
|
|
83
|
-
},
|
|
84
|
-
},
|
|
85
|
-
};
|
|
86
|
-
jest.mock('../redux/selectors/inputs', () => ({
|
|
87
|
-
__esModule: true,
|
|
88
|
-
selectOptionInput: (id) => mockInputs.options[id],
|
|
89
|
-
selectOptionInputByIndex: (id, index) => mockInputs.options[id][index],
|
|
90
|
-
}));
|
|
91
|
-
jest.mock('../redux/selectors/references', () => ({
|
|
92
|
-
__esModule: true,
|
|
93
|
-
selectSectionReference: (id) => mockReferences.sections.main[id],
|
|
94
|
-
selectOptionReference: (id) => mockReferences.options[id],
|
|
95
|
-
}));
|
|
96
|
-
jest.mock('../redux/selectors/conditions', () => ({
|
|
97
|
-
__esModule: true,
|
|
98
|
-
selectOptionConditionValue: (id, index) => mockConditions.options[id][index],
|
|
99
|
-
selectOptionValidatorConditionValue: (id, index) => mockConditions.validators.options[id][index],
|
|
100
|
-
selectVariableConditionValue: (id, index) => mockConditions.variables[id][index],
|
|
101
|
-
selectVariableValidatorConditionValue: (id, index) => mockConditions.validators.variables[id][index],
|
|
102
|
-
}));
|
|
103
|
-
describe('SectionValidity library test suit', () => {
|
|
104
|
-
it('Checks valid section', () => {
|
|
105
|
-
expect(new SectionValidity(1).validity).toBeTruthy();
|
|
106
|
-
});
|
|
107
|
-
it('Checks unvalid section', () => {
|
|
108
|
-
expect(new SectionValidity(2).validity).toBeFalsy();
|
|
109
|
-
});
|
|
110
|
-
it('Should throw an error if option reference does not exist', () => {
|
|
111
|
-
expect(() => new SectionValidity(3).validity).toThrowError('Option 1032 does not exist');
|
|
112
|
-
});
|
|
113
|
-
it('Should throw an error if section does not exist', () => {
|
|
114
|
-
expect(() => new SectionValidity(4).validity).toThrowError('Section 4 does not exist');
|
|
115
|
-
});
|
|
116
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import { initMetaAction, initInstanceAction, updateInstancePaidAction, initPaginationAction, goPageAction, goNextPageAction, goPreviousPageAction, updateAvailableSectionsAction, } from './app';
|
|
2
|
-
describe('App actions test suit', () => {
|
|
3
|
-
it('initMeta Action', () => {
|
|
4
|
-
const action = initMetaAction({
|
|
5
|
-
id: 123,
|
|
6
|
-
prefix: '',
|
|
7
|
-
permalink: 'document-permalink',
|
|
8
|
-
title: 'Title',
|
|
9
|
-
modelVersion: 1,
|
|
10
|
-
productType: 'demarche',
|
|
11
|
-
});
|
|
12
|
-
return expect(action).toStrictEqual({
|
|
13
|
-
type: 'INIT_META',
|
|
14
|
-
id: 123,
|
|
15
|
-
prefix: '',
|
|
16
|
-
permalink: 'document-permalink',
|
|
17
|
-
title: 'Title',
|
|
18
|
-
modelVersion: 1,
|
|
19
|
-
productType: 'demarche',
|
|
20
|
-
});
|
|
21
|
-
});
|
|
22
|
-
it('initInstance Action', () => {
|
|
23
|
-
const action = initInstanceAction({
|
|
24
|
-
dataStatus: 'saved',
|
|
25
|
-
uniqid: 'ubsd989ded3',
|
|
26
|
-
isPaid: false,
|
|
27
|
-
steps: '*',
|
|
28
|
-
});
|
|
29
|
-
return expect(action).toStrictEqual({
|
|
30
|
-
type: 'INIT_INSTANCE',
|
|
31
|
-
dataStatus: 'saved',
|
|
32
|
-
uniqid: 'ubsd989ded3',
|
|
33
|
-
isPaid: false,
|
|
34
|
-
steps: '*',
|
|
35
|
-
});
|
|
36
|
-
});
|
|
37
|
-
it('updateInstancePaid Action', () => {
|
|
38
|
-
const action = updateInstancePaidAction(true);
|
|
39
|
-
return expect(action).toStrictEqual({
|
|
40
|
-
type: 'UPDATE_INSTANCE_PAID',
|
|
41
|
-
isPaid: true,
|
|
42
|
-
});
|
|
43
|
-
});
|
|
44
|
-
it('initPagination Action', () => {
|
|
45
|
-
const action = initPaginationAction({
|
|
46
|
-
currentSectionId: 1,
|
|
47
|
-
currentPage: 1,
|
|
48
|
-
greatestPage: 1,
|
|
49
|
-
availableSections: [1, 2, 3],
|
|
50
|
-
availableAppStates: ['wizard'],
|
|
51
|
-
currentAppState: 'wizard',
|
|
52
|
-
});
|
|
53
|
-
return expect(action).toStrictEqual({
|
|
54
|
-
type: 'INIT_PAGINATION',
|
|
55
|
-
currentSectionId: 1,
|
|
56
|
-
currentPage: 1,
|
|
57
|
-
greatestPage: 1,
|
|
58
|
-
availableSections: [1, 2, 3],
|
|
59
|
-
availableAppStates: ['wizard'],
|
|
60
|
-
currentAppState: 'wizard',
|
|
61
|
-
});
|
|
62
|
-
});
|
|
63
|
-
it('goPage Action', () => {
|
|
64
|
-
const action = goPageAction(9);
|
|
65
|
-
return expect(action).toStrictEqual({
|
|
66
|
-
type: 'GO_PAGE',
|
|
67
|
-
currentPage: 9,
|
|
68
|
-
pushHistory: true,
|
|
69
|
-
});
|
|
70
|
-
});
|
|
71
|
-
it('goNextPage Action', () => {
|
|
72
|
-
const action = goNextPageAction();
|
|
73
|
-
return expect(action).toStrictEqual({
|
|
74
|
-
type: 'GO_NEXT_PAGE',
|
|
75
|
-
});
|
|
76
|
-
});
|
|
77
|
-
it('goPreviousPage Action', () => {
|
|
78
|
-
const action = goPreviousPageAction();
|
|
79
|
-
return expect(action).toStrictEqual({
|
|
80
|
-
type: 'GO_PREVIOUS_PAGE',
|
|
81
|
-
});
|
|
82
|
-
});
|
|
83
|
-
it('updateAvailableSections Action', () => {
|
|
84
|
-
const action = updateAvailableSectionsAction([1, 2, 3]);
|
|
85
|
-
return expect(action).toStrictEqual({
|
|
86
|
-
type: 'UPDATE_AVAILABLE_SECTIONS',
|
|
87
|
-
availableSections: [1, 2, 3],
|
|
88
|
-
});
|
|
89
|
-
});
|
|
90
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import { initConditionsAction, updateOptionConditionsAction, updateVariableConditionsAction, updateSectionConditionsAction, updatePrefillersConditionsAction, } from './conditions';
|
|
2
|
-
describe('Conditions actions test suit', () => {
|
|
3
|
-
it('initConditions Action', () => {
|
|
4
|
-
const action = initConditionsAction({
|
|
5
|
-
options: {},
|
|
6
|
-
variables: {},
|
|
7
|
-
prefillers: {},
|
|
8
|
-
validators: {
|
|
9
|
-
options: {},
|
|
10
|
-
variables: {},
|
|
11
|
-
},
|
|
12
|
-
sections: {
|
|
13
|
-
main: {},
|
|
14
|
-
},
|
|
15
|
-
documents: {},
|
|
16
|
-
});
|
|
17
|
-
expect(action).toEqual({
|
|
18
|
-
type: 'INIT_CONDITIONS',
|
|
19
|
-
options: {},
|
|
20
|
-
variables: {},
|
|
21
|
-
prefillers: {},
|
|
22
|
-
validators: {
|
|
23
|
-
options: {},
|
|
24
|
-
variables: {},
|
|
25
|
-
},
|
|
26
|
-
sections: {
|
|
27
|
-
main: {},
|
|
28
|
-
},
|
|
29
|
-
documents: {},
|
|
30
|
-
});
|
|
31
|
-
});
|
|
32
|
-
it('updateOptionConditions Action', () => {
|
|
33
|
-
const action = updateOptionConditionsAction(1, 0, true);
|
|
34
|
-
expect(action).toEqual({
|
|
35
|
-
type: 'UPDATE_OPTION_CONDITION',
|
|
36
|
-
id: 1,
|
|
37
|
-
index: 0,
|
|
38
|
-
value: true,
|
|
39
|
-
});
|
|
40
|
-
});
|
|
41
|
-
it('updateVariableConditions Action', () => {
|
|
42
|
-
const action = updateVariableConditionsAction(1, 0, true);
|
|
43
|
-
expect(action).toEqual({
|
|
44
|
-
type: 'UPDATE_VARIABLE_CONDITION',
|
|
45
|
-
id: 1,
|
|
46
|
-
index: 0,
|
|
47
|
-
value: true,
|
|
48
|
-
});
|
|
49
|
-
});
|
|
50
|
-
it('updateSectionConditions Action', () => {
|
|
51
|
-
const action = updateSectionConditionsAction(1, 'main', true);
|
|
52
|
-
expect(action).toEqual({
|
|
53
|
-
type: 'UPDATE_SECTION_CONDITION',
|
|
54
|
-
id: 1,
|
|
55
|
-
document: 'main',
|
|
56
|
-
value: true,
|
|
57
|
-
});
|
|
58
|
-
});
|
|
59
|
-
it('updatePrefillersConditions Action', () => {
|
|
60
|
-
const action = updatePrefillersConditionsAction(1, 0, [true]);
|
|
61
|
-
expect(action).toEqual({
|
|
62
|
-
type: 'UPDATE_PREFILLER_CONDITION',
|
|
63
|
-
id: 1,
|
|
64
|
-
index: 0,
|
|
65
|
-
value: [true],
|
|
66
|
-
});
|
|
67
|
-
});
|
|
68
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { initOptionAction, initVariableAction, updateOptionAction, updateVariableAction, addMultipleOccurencyAction, deleteMultipleOccurencyAction, } from './inputs';
|
|
2
|
-
import { UPDATE_OPTION_INPUT, INIT_VARIABLE, INIT_OPTION, UPDATE_VARIABLE_INPUT, ADD_MULTIPLE_OCCURENCY, DELETE_MULTIPLE_OCCURENCY, } from '../constants/inputs';
|
|
3
|
-
describe('Inputs actions test suit', () => {
|
|
4
|
-
it('initOption Action', () => {
|
|
5
|
-
const action = initOptionAction(123, [true]);
|
|
6
|
-
return expect(action).toStrictEqual({
|
|
7
|
-
type: INIT_OPTION,
|
|
8
|
-
id: 123,
|
|
9
|
-
values: [true],
|
|
10
|
-
});
|
|
11
|
-
});
|
|
12
|
-
it('initVariable Action', () => {
|
|
13
|
-
const action = initVariableAction(123, ['']);
|
|
14
|
-
return expect(action).toStrictEqual({
|
|
15
|
-
type: INIT_VARIABLE,
|
|
16
|
-
id: 123,
|
|
17
|
-
values: [''],
|
|
18
|
-
});
|
|
19
|
-
});
|
|
20
|
-
it('updateOption Action', () => {
|
|
21
|
-
const action = updateOptionAction(123, true, 3);
|
|
22
|
-
return expect(action).toStrictEqual({
|
|
23
|
-
type: UPDATE_OPTION_INPUT,
|
|
24
|
-
id: 123,
|
|
25
|
-
value: true,
|
|
26
|
-
index: 3,
|
|
27
|
-
});
|
|
28
|
-
});
|
|
29
|
-
it('updateVariable Action', () => {
|
|
30
|
-
const action = updateVariableAction(123, 'Hello', 1);
|
|
31
|
-
return expect(action).toStrictEqual({
|
|
32
|
-
type: UPDATE_VARIABLE_INPUT,
|
|
33
|
-
id: 123,
|
|
34
|
-
value: 'Hello',
|
|
35
|
-
index: 1,
|
|
36
|
-
});
|
|
37
|
-
});
|
|
38
|
-
it('addMultipleOccurency Action', () => {
|
|
39
|
-
const action = addMultipleOccurencyAction(123);
|
|
40
|
-
return expect(action).toStrictEqual({
|
|
41
|
-
type: ADD_MULTIPLE_OCCURENCY,
|
|
42
|
-
id: 123,
|
|
43
|
-
});
|
|
44
|
-
});
|
|
45
|
-
it('deleteMultipleOccurency Action', () => {
|
|
46
|
-
const action = deleteMultipleOccurencyAction(123, 1);
|
|
47
|
-
return expect(action).toStrictEqual({
|
|
48
|
-
type: DELETE_MULTIPLE_OCCURENCY,
|
|
49
|
-
id: 123,
|
|
50
|
-
index: 1,
|
|
51
|
-
});
|
|
52
|
-
});
|
|
53
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { initReferencesAction } from './references';
|
|
2
|
-
describe('References actions test suit', () => {
|
|
3
|
-
it('initReferences Action', () => {
|
|
4
|
-
const _obj = {
|
|
5
|
-
options: {},
|
|
6
|
-
variables: {},
|
|
7
|
-
relations: {
|
|
8
|
-
options: {},
|
|
9
|
-
variables: {},
|
|
10
|
-
sections: {},
|
|
11
|
-
},
|
|
12
|
-
conditions: {
|
|
13
|
-
options: {},
|
|
14
|
-
variables: {},
|
|
15
|
-
prefillers: {},
|
|
16
|
-
validators: {
|
|
17
|
-
options: {},
|
|
18
|
-
variables: {},
|
|
19
|
-
},
|
|
20
|
-
sections: {},
|
|
21
|
-
documents: {},
|
|
22
|
-
},
|
|
23
|
-
sections: {
|
|
24
|
-
main: {
|
|
25
|
-
'1': {
|
|
26
|
-
id: 1,
|
|
27
|
-
label: 'Some label',
|
|
28
|
-
options: [],
|
|
29
|
-
},
|
|
30
|
-
},
|
|
31
|
-
},
|
|
32
|
-
documents: {},
|
|
33
|
-
defaults: {},
|
|
34
|
-
outputs: {},
|
|
35
|
-
evaluations: {},
|
|
36
|
-
boxes: {},
|
|
37
|
-
optionTags: {},
|
|
38
|
-
variableTags: {}
|
|
39
|
-
};
|
|
40
|
-
const action = initReferencesAction(_obj);
|
|
41
|
-
expect(action).toEqual(Object.assign({ type: 'INIT_REFERENCES' }, _obj));
|
|
42
|
-
});
|
|
43
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { saveDataAction } from './data';
|
|
2
|
-
it('Returns saveData action properkt', () => {
|
|
3
|
-
expect(saveDataAction()).toStrictEqual({
|
|
4
|
-
confirmAnswer: undefined,
|
|
5
|
-
additionalProperties: undefined,
|
|
6
|
-
type: 'SAVE_DATA',
|
|
7
|
-
redirect: false,
|
|
8
|
-
redirectFallback: undefined,
|
|
9
|
-
redirectOverride: undefined,
|
|
10
|
-
});
|
|
11
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { fetchModelPrerequisitesAction } from './model';
|
|
2
|
-
describe('Saga model actions test suit', () => {
|
|
3
|
-
it('fetchModelPrerequisites Action', () => {
|
|
4
|
-
const action = fetchModelPrerequisitesAction('test-debug');
|
|
5
|
-
return expect(action).toStrictEqual({
|
|
6
|
-
type: 'FETCH_MODEL_PREREQUISITES',
|
|
7
|
-
permalink: 'test-debug',
|
|
8
|
-
prefix: '',
|
|
9
|
-
});
|
|
10
|
-
});
|
|
11
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { initUserAction } from './user';
|
|
2
|
-
describe('User actions test suit', () => {
|
|
3
|
-
it('initUser Action', () => {
|
|
4
|
-
const action = initUserAction({
|
|
5
|
-
level: 'ADMIN',
|
|
6
|
-
email: 'doe@legalplace.fr',
|
|
7
|
-
displayName: 'John Doe',
|
|
8
|
-
});
|
|
9
|
-
return expect(action).toStrictEqual({
|
|
10
|
-
type: 'INIT_USER',
|
|
11
|
-
level: 'ADMIN',
|
|
12
|
-
email: 'doe@legalplace.fr',
|
|
13
|
-
displayName: 'John Doe',
|
|
14
|
-
});
|
|
15
|
-
});
|
|
16
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { combineReducers, createStore } from 'redux';
|
|
2
|
-
import subscribeListeners from './subscriber';
|
|
3
|
-
describe('Store subscriber test suit', () => {
|
|
4
|
-
it('Subscribes a listener correctly to the store', () => {
|
|
5
|
-
const initialState = 0;
|
|
6
|
-
const goNextPageReducer = (state = initialState, action) => {
|
|
7
|
-
let page = state;
|
|
8
|
-
if (action.type === 'GO_NEXT_PAGE')
|
|
9
|
-
page += 1;
|
|
10
|
-
return page;
|
|
11
|
-
};
|
|
12
|
-
const store = createStore(combineReducers({ page: goNextPageReducer }));
|
|
13
|
-
const result = {
|
|
14
|
-
currentPage: 0,
|
|
15
|
-
previousPage: 0,
|
|
16
|
-
};
|
|
17
|
-
const listener = (previousState, currentState, dispatch) => {
|
|
18
|
-
result.currentPage = currentState.page;
|
|
19
|
-
if (typeof dispatch === 'function')
|
|
20
|
-
result.previousPage = previousState ? previousState.page : 0;
|
|
21
|
-
};
|
|
22
|
-
subscribeListeners(store, [listener]);
|
|
23
|
-
store.dispatch({ type: 'GO_NEXT_PAGE' });
|
|
24
|
-
store.dispatch({ type: 'GO_NEXT_PAGE' });
|
|
25
|
-
store.dispatch({ type: 'GO_NEXT_PAGE' });
|
|
26
|
-
expect(result).toStrictEqual({
|
|
27
|
-
currentPage: 3,
|
|
28
|
-
previousPage: 2,
|
|
29
|
-
});
|
|
30
|
-
});
|
|
31
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|