@inseefr/lunatic 0.3.4-experimental → 0.3.7-experimental
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/lib/index.js +2 -2
- package/lib/index.js.map +1 -1
- package/package.json +2 -1
- package/src/components/breadcrumb/component.js +29 -29
- package/src/components/button/component.js +53 -53
- package/src/components/button/index.js +1 -1
- package/src/components/checkbox/index.js +3 -3
- package/src/components/datepicker/index.js +1 -1
- package/src/components/declarations/index.js +1 -1
- package/src/components/declarations/wrappers/list-declarations-wrapper.js +232 -232
- package/src/components/filter-description/component.js +42 -42
- package/src/components/icon/component.js +33 -33
- package/src/components/index.js +2 -0
- package/src/components/input/index.js +2 -2
- package/src/components/loop/index.js +1 -1
- package/src/components/loop-constructor/wrapper/body-component.js +13 -1
- package/src/components/radio/index.js +1 -1
- package/src/components/sequence/index.js +1 -1
- package/src/components/subsequence/index.js +1 -1
- package/src/components/suggester/check-store.js +70 -70
- package/src/components/suggester/components/create-on-keydown-callback.js +28 -28
- package/src/components/tooltip/response.js +52 -52
- package/src/stories/checkbox-boolean/data-forced.json +48 -48
- package/src/stories/checkbox-group/data-vtl.json +102 -102
- package/src/stories/icons/icons.stories.js +16 -16
- package/src/stories/questionnaire/kish.json +275 -0
- package/src/stories/questionnaire/questionnaire.stories.js +12 -0
- package/src/stories/utils/custom-lunatic.scss +23 -23
- package/src/tests/components/breadcrumb.spec.js +13 -13
- package/src/tests/components/button.spec.js +11 -11
- package/src/tests/components/checkbox-boolean.spec.js +45 -45
- package/src/tests/components/checkbox-group.spec.js +53 -53
- package/src/tests/components/checkbox-one.spec.js +32 -32
- package/src/tests/components/datepicker.spec.js +22 -22
- package/src/tests/components/declarations-wrappers/input-declarations-wrapper.spec.js +67 -67
- package/src/tests/components/declarations-wrappers/list-declarations-wrapper.spec.js +52 -52
- package/src/tests/components/declarations-wrappers/simple-declarations-wrapper.spec.js +21 -21
- package/src/tests/components/declarations.spec.js +46 -46
- package/src/tests/components/input.spec.js +18 -18
- package/src/tests/components/loops/loop-static.json +66 -66
- package/src/tests/components/loops/loop.json +258 -258
- package/src/tests/components/loops/loop.spec.js +30 -30
- package/src/tests/components/loops/roster-for-loop.spec.js +18 -18
- package/src/tests/components/progress-bar.spec.js +15 -15
- package/src/tests/components/radio.spec.js +27 -27
- package/src/tests/components/sequence.spec.js +9 -9
- package/src/tests/components/subsequence.spec.js +9 -9
- package/src/tests/components/table.spec.js +11 -11
- package/src/tests/components/textarea.spec.js +18 -18
- package/src/tests/components/tooltip.spec.js +25 -25
- package/src/tests/setup/setupTests.js +4 -4
- package/src/tests/utils/lib/alphabet.spec.js +36 -36
- package/src/tests/utils/lib/array.spec.js +22 -22
- package/src/tests/utils/lib/checkbox/group.spec.js +72 -72
- package/src/tests/utils/lib/decorator/title-decorator.spec.js +12 -12
- package/src/tests/utils/lib/input-number.spec.js +18 -18
- package/src/tests/utils/lib/items-positioning.spec.js +17 -17
- package/src/tests/utils/lib/label-position.spec.js +22 -22
- package/src/tests/utils/lib/loops/bindings.spec.js +75 -75
- package/src/tests/utils/lib/loops/shared.spec.js +82 -82
- package/src/tests/utils/lib/missing/missing.spec.js +74 -74
- package/src/tests/utils/lib/missing/mock.js +137 -137
- package/src/tests/utils/lib/pagination/shared.spec.js +42 -42
- package/src/tests/utils/lib/responses.spec.js +64 -64
- package/src/tests/utils/lib/style.spec.js +26 -26
- package/src/tests/utils/lib/tooltip/build-response.spec.js +95 -95
- package/src/tests/utils/lib/tooltip/content.spec.js +109 -109
- package/src/tests/utils/to-expose/handler/handler.spec.js +94 -94
- package/src/tests/utils/to-expose/handler/questionnaire.json +158 -158
- package/src/tests/utils/to-expose/handler/results/index.js +6 -6
- package/src/tests/utils/to-expose/handler/results/res-double.json +158 -158
- package/src/tests/utils/to-expose/handler/results/res-input-collected.json +158 -158
- package/src/tests/utils/to-expose/handler/results/res-loop.json +158 -158
- package/src/tests/utils/to-expose/handler/results/res-matrix.json +158 -158
- package/src/tests/utils/to-expose/handler/results/res-responses.json +158 -158
- package/src/tests/utils/to-expose/hooks/use-lunatic.spec.js +46 -46
- package/src/tests/utils/to-expose/init-questionnaire/data.json +12 -12
- package/src/tests/utils/to-expose/init-questionnaire/init-questionnaire.spec.js +19 -19
- package/src/tests/utils/to-expose/interpret/interpret.spec.js +48 -48
- package/src/tests/utils/to-expose/state/questionnaire.json +61 -61
- package/src/tests/utils/to-expose/state/results.js +78 -78
- package/src/utils/lib/tooltip/build-response.js +41 -41
- package/src/utils/store-tools/create/index.js +1 -1
- package/src/utils/store-tools/create/update-store-info.js +26 -26
- package/src/utils/store-tools/index.js +5 -5
|
@@ -1,75 +1,75 @@
|
|
|
1
|
-
import * as U from 'utils/lib';
|
|
2
|
-
|
|
3
|
-
const bindings = { A: 'AAA', B: ['b', 'bb'] };
|
|
4
|
-
|
|
5
|
-
describe('loop bindings utils', () => {
|
|
6
|
-
describe('buildBindingsForDeeperComponents', () => {
|
|
7
|
-
it('should return default value', () => {
|
|
8
|
-
expect(U.buildBindingsForDeeperComponents()()).toEqual({});
|
|
9
|
-
expect(U.buildBindingsForDeeperComponents(0)()).toEqual({});
|
|
10
|
-
expect(U.buildBindingsForDeeperComponents()({})).toEqual({});
|
|
11
|
-
});
|
|
12
|
-
it('should return bindings for loop', () => {
|
|
13
|
-
expect(U.buildBindingsForDeeperComponents(1)(bindings)).toEqual({
|
|
14
|
-
A: 'AAA',
|
|
15
|
-
B: 'bb',
|
|
16
|
-
});
|
|
17
|
-
});
|
|
18
|
-
});
|
|
19
|
-
describe('buildLoopBindings', () => {
|
|
20
|
-
it('should return default value', () => {
|
|
21
|
-
expect(U.buildLoopBindings(0)()).toEqual({});
|
|
22
|
-
expect(U.buildLoopBindings(0)({})).toEqual({});
|
|
23
|
-
});
|
|
24
|
-
it('should return bindings for loop', () => {
|
|
25
|
-
expect(
|
|
26
|
-
U.buildLoopBindings(1)([
|
|
27
|
-
['a', 'A'],
|
|
28
|
-
['b', ['B0', 'B1']],
|
|
29
|
-
])
|
|
30
|
-
).toEqual({
|
|
31
|
-
a: 'A',
|
|
32
|
-
b: 'B1',
|
|
33
|
-
});
|
|
34
|
-
});
|
|
35
|
-
});
|
|
36
|
-
describe('buildVectorialBindings', () => {
|
|
37
|
-
it('should return default value', () => {
|
|
38
|
-
expect(U.buildVectorialBindings()).toEqual({});
|
|
39
|
-
expect(U.buildVectorialBindings({})).toEqual({});
|
|
40
|
-
});
|
|
41
|
-
it('should return vectorial bindings', () => {
|
|
42
|
-
expect(U.buildVectorialBindings(bindings)).toEqual({
|
|
43
|
-
A: 'AAA',
|
|
44
|
-
B: { dataStructure: { B: {} }, dataPoints: { B: ['b', 'bb'] } },
|
|
45
|
-
});
|
|
46
|
-
});
|
|
47
|
-
});
|
|
48
|
-
describe('displayLoop', () => {
|
|
49
|
-
it('should return default value', () => {
|
|
50
|
-
expect(U.displayLoop()()).toBeFalsy();
|
|
51
|
-
expect(U.displayLoop([])({})).toBeFalsy();
|
|
52
|
-
});
|
|
53
|
-
it('should return display loop', () => {
|
|
54
|
-
expect(U.displayLoop(['A'])({ A: [null] })).toBeFalsy();
|
|
55
|
-
});
|
|
56
|
-
it('should return display loop', () => {
|
|
57
|
-
expect(U.displayLoop(['A'])({ A: ['a'] })).toBeTruthy();
|
|
58
|
-
});
|
|
59
|
-
});
|
|
60
|
-
describe('displayLoopQuestion', () => {
|
|
61
|
-
it('should return default value', () => {
|
|
62
|
-
expect(U.displayLoopQuestion()()).toBeFalsy();
|
|
63
|
-
expect(U.displayLoopQuestion([])({})).toBeFalsy();
|
|
64
|
-
});
|
|
65
|
-
it('should return display loop', () => {
|
|
66
|
-
expect(
|
|
67
|
-
U.displayLoopQuestion(['A', 'B'])({ A: [[null]], B: null })
|
|
68
|
-
).toBeFalsy();
|
|
69
|
-
});
|
|
70
|
-
it('should return display loop', () => {
|
|
71
|
-
expect(U.displayLoopQuestion(['A'])({ A: [[null]] })).toBeTruthy();
|
|
72
|
-
expect(U.displayLoopQuestion(['A'])({ A: 'a' })).toBeTruthy();
|
|
73
|
-
});
|
|
74
|
-
});
|
|
75
|
-
});
|
|
1
|
+
import * as U from 'utils/lib';
|
|
2
|
+
|
|
3
|
+
const bindings = { A: 'AAA', B: ['b', 'bb'] };
|
|
4
|
+
|
|
5
|
+
describe('loop bindings utils', () => {
|
|
6
|
+
describe('buildBindingsForDeeperComponents', () => {
|
|
7
|
+
it('should return default value', () => {
|
|
8
|
+
expect(U.buildBindingsForDeeperComponents()()).toEqual({});
|
|
9
|
+
expect(U.buildBindingsForDeeperComponents(0)()).toEqual({});
|
|
10
|
+
expect(U.buildBindingsForDeeperComponents()({})).toEqual({});
|
|
11
|
+
});
|
|
12
|
+
it('should return bindings for loop', () => {
|
|
13
|
+
expect(U.buildBindingsForDeeperComponents(1)(bindings)).toEqual({
|
|
14
|
+
A: 'AAA',
|
|
15
|
+
B: 'bb',
|
|
16
|
+
});
|
|
17
|
+
});
|
|
18
|
+
});
|
|
19
|
+
describe('buildLoopBindings', () => {
|
|
20
|
+
it('should return default value', () => {
|
|
21
|
+
expect(U.buildLoopBindings(0)()).toEqual({});
|
|
22
|
+
expect(U.buildLoopBindings(0)({})).toEqual({});
|
|
23
|
+
});
|
|
24
|
+
it('should return bindings for loop', () => {
|
|
25
|
+
expect(
|
|
26
|
+
U.buildLoopBindings(1)([
|
|
27
|
+
['a', 'A'],
|
|
28
|
+
['b', ['B0', 'B1']],
|
|
29
|
+
])
|
|
30
|
+
).toEqual({
|
|
31
|
+
a: 'A',
|
|
32
|
+
b: 'B1',
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
describe('buildVectorialBindings', () => {
|
|
37
|
+
it('should return default value', () => {
|
|
38
|
+
expect(U.buildVectorialBindings()).toEqual({});
|
|
39
|
+
expect(U.buildVectorialBindings({})).toEqual({});
|
|
40
|
+
});
|
|
41
|
+
it('should return vectorial bindings', () => {
|
|
42
|
+
expect(U.buildVectorialBindings(bindings)).toEqual({
|
|
43
|
+
A: 'AAA',
|
|
44
|
+
B: { dataStructure: { B: {} }, dataPoints: { B: ['b', 'bb'] } },
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
describe('displayLoop', () => {
|
|
49
|
+
it('should return default value', () => {
|
|
50
|
+
expect(U.displayLoop()()).toBeFalsy();
|
|
51
|
+
expect(U.displayLoop([])({})).toBeFalsy();
|
|
52
|
+
});
|
|
53
|
+
it('should return display loop', () => {
|
|
54
|
+
expect(U.displayLoop(['A'])({ A: [null] })).toBeFalsy();
|
|
55
|
+
});
|
|
56
|
+
it('should return display loop', () => {
|
|
57
|
+
expect(U.displayLoop(['A'])({ A: ['a'] })).toBeTruthy();
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
describe('displayLoopQuestion', () => {
|
|
61
|
+
it('should return default value', () => {
|
|
62
|
+
expect(U.displayLoopQuestion()()).toBeFalsy();
|
|
63
|
+
expect(U.displayLoopQuestion([])({})).toBeFalsy();
|
|
64
|
+
});
|
|
65
|
+
it('should return display loop', () => {
|
|
66
|
+
expect(
|
|
67
|
+
U.displayLoopQuestion(['A', 'B'])({ A: [[null]], B: null })
|
|
68
|
+
).toBeFalsy();
|
|
69
|
+
});
|
|
70
|
+
it('should return display loop', () => {
|
|
71
|
+
expect(U.displayLoopQuestion(['A'])({ A: [[null]] })).toBeTruthy();
|
|
72
|
+
expect(U.displayLoopQuestion(['A'])({ A: 'a' })).toBeTruthy();
|
|
73
|
+
});
|
|
74
|
+
});
|
|
75
|
+
});
|
|
@@ -1,82 +1,82 @@
|
|
|
1
|
-
import * as U from 'utils/lib';
|
|
2
|
-
|
|
3
|
-
const componentsForInit = [
|
|
4
|
-
{
|
|
5
|
-
id: '1',
|
|
6
|
-
response: { name: 'a', values: { COLLECTED: [null, 'a'] } },
|
|
7
|
-
missingResponse: { name: 'z', depth: 0 },
|
|
8
|
-
depth: 0,
|
|
9
|
-
},
|
|
10
|
-
{
|
|
11
|
-
id: '2',
|
|
12
|
-
response: { name: 'b', values: { COLLECTED: [null, 'b'] } },
|
|
13
|
-
depth: 0,
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
id: '3',
|
|
17
|
-
responses: [
|
|
18
|
-
{
|
|
19
|
-
id: '3.1',
|
|
20
|
-
depth: 1,
|
|
21
|
-
response: { name: 'c', values: { COLLECTED: [null, null] } },
|
|
22
|
-
missingResponse: { name: 'zz', depth: 1 },
|
|
23
|
-
},
|
|
24
|
-
],
|
|
25
|
-
},
|
|
26
|
-
];
|
|
27
|
-
|
|
28
|
-
describe('loop roster utils', () => {
|
|
29
|
-
describe('getLoopConstructorInitLines', () => {
|
|
30
|
-
it('should return default value', () => {
|
|
31
|
-
expect(U.getLoopConstructorInitLines()).toEqual(0);
|
|
32
|
-
expect(U.getLoopConstructorInitLines([])).toEqual(0);
|
|
33
|
-
});
|
|
34
|
-
it('should return roster init line length', () => {
|
|
35
|
-
expect(U.getLoopConstructorInitLines(componentsForInit)).toEqual(2);
|
|
36
|
-
});
|
|
37
|
-
});
|
|
38
|
-
describe('getInvolvedVariables', () => {
|
|
39
|
-
it('should return default value', () => {
|
|
40
|
-
expect(U.getInvolvedVariables()).toEqual([]);
|
|
41
|
-
expect(U.getInvolvedVariables([])).toEqual([]);
|
|
42
|
-
});
|
|
43
|
-
it('should return variables involved into roster for loop', () => {
|
|
44
|
-
expect(U.getInvolvedVariables(componentsForInit)).toEqual([
|
|
45
|
-
{ name: 'a', depth: 0 },
|
|
46
|
-
{ name: 'z', depth: 0 },
|
|
47
|
-
{ name: 'b', depth: 0 },
|
|
48
|
-
{ name: 'c', depth: 1 },
|
|
49
|
-
{ name: 'zz', depth: 1 },
|
|
50
|
-
]);
|
|
51
|
-
});
|
|
52
|
-
});
|
|
53
|
-
describe('lastLoopChildLineIsEmpty', () => {
|
|
54
|
-
it('should return default value', () => {
|
|
55
|
-
expect(U.lastLoopChildLineIsEmpty()()).toBeTruthy();
|
|
56
|
-
expect(U.lastLoopChildLineIsEmpty({})([])).toBeTruthy();
|
|
57
|
-
});
|
|
58
|
-
it('should return last line is not empty', () => {
|
|
59
|
-
const d = { A: [null, 'a'], B: ['b', null] };
|
|
60
|
-
const iv = [{ name: 'A' }, { name: 'B' }];
|
|
61
|
-
expect(U.lastLoopChildLineIsEmpty(d)(iv)).toBeFalsy();
|
|
62
|
-
});
|
|
63
|
-
it('should return last line is empty', () => {
|
|
64
|
-
const d = { A: [null, null], B: ['b', null] };
|
|
65
|
-
const iv = [{ name: 'A' }, { name: 'B' }];
|
|
66
|
-
expect(U.lastLoopChildLineIsEmpty(d)(iv)).toBeTruthy();
|
|
67
|
-
});
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
describe('buildEmptyValue', () => {
|
|
71
|
-
it('should return default value', () => {
|
|
72
|
-
expect(U.buildEmptyValue()).toBeNull();
|
|
73
|
-
expect(U.buildEmptyValue(0)).toBeNull();
|
|
74
|
-
expect(U.buildEmptyValue(1)).toBeNull();
|
|
75
|
-
expect(U.buildEmptyValue(2)).toBeNull();
|
|
76
|
-
});
|
|
77
|
-
it('should return null array thanks to depth', () => {
|
|
78
|
-
expect(U.buildEmptyValue(3)).toEqual([null]);
|
|
79
|
-
expect(U.buildEmptyValue(4)).toEqual([[null]]);
|
|
80
|
-
});
|
|
81
|
-
});
|
|
82
|
-
});
|
|
1
|
+
import * as U from 'utils/lib';
|
|
2
|
+
|
|
3
|
+
const componentsForInit = [
|
|
4
|
+
{
|
|
5
|
+
id: '1',
|
|
6
|
+
response: { name: 'a', values: { COLLECTED: [null, 'a'] } },
|
|
7
|
+
missingResponse: { name: 'z', depth: 0 },
|
|
8
|
+
depth: 0,
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
id: '2',
|
|
12
|
+
response: { name: 'b', values: { COLLECTED: [null, 'b'] } },
|
|
13
|
+
depth: 0,
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
id: '3',
|
|
17
|
+
responses: [
|
|
18
|
+
{
|
|
19
|
+
id: '3.1',
|
|
20
|
+
depth: 1,
|
|
21
|
+
response: { name: 'c', values: { COLLECTED: [null, null] } },
|
|
22
|
+
missingResponse: { name: 'zz', depth: 1 },
|
|
23
|
+
},
|
|
24
|
+
],
|
|
25
|
+
},
|
|
26
|
+
];
|
|
27
|
+
|
|
28
|
+
describe('loop roster utils', () => {
|
|
29
|
+
describe('getLoopConstructorInitLines', () => {
|
|
30
|
+
it('should return default value', () => {
|
|
31
|
+
expect(U.getLoopConstructorInitLines()).toEqual(0);
|
|
32
|
+
expect(U.getLoopConstructorInitLines([])).toEqual(0);
|
|
33
|
+
});
|
|
34
|
+
it('should return roster init line length', () => {
|
|
35
|
+
expect(U.getLoopConstructorInitLines(componentsForInit)).toEqual(2);
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
describe('getInvolvedVariables', () => {
|
|
39
|
+
it('should return default value', () => {
|
|
40
|
+
expect(U.getInvolvedVariables()).toEqual([]);
|
|
41
|
+
expect(U.getInvolvedVariables([])).toEqual([]);
|
|
42
|
+
});
|
|
43
|
+
it('should return variables involved into roster for loop', () => {
|
|
44
|
+
expect(U.getInvolvedVariables(componentsForInit)).toEqual([
|
|
45
|
+
{ name: 'a', depth: 0 },
|
|
46
|
+
{ name: 'z', depth: 0 },
|
|
47
|
+
{ name: 'b', depth: 0 },
|
|
48
|
+
{ name: 'c', depth: 1 },
|
|
49
|
+
{ name: 'zz', depth: 1 },
|
|
50
|
+
]);
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
describe('lastLoopChildLineIsEmpty', () => {
|
|
54
|
+
it('should return default value', () => {
|
|
55
|
+
expect(U.lastLoopChildLineIsEmpty()()).toBeTruthy();
|
|
56
|
+
expect(U.lastLoopChildLineIsEmpty({})([])).toBeTruthy();
|
|
57
|
+
});
|
|
58
|
+
it('should return last line is not empty', () => {
|
|
59
|
+
const d = { A: [null, 'a'], B: ['b', null] };
|
|
60
|
+
const iv = [{ name: 'A' }, { name: 'B' }];
|
|
61
|
+
expect(U.lastLoopChildLineIsEmpty(d)(iv)).toBeFalsy();
|
|
62
|
+
});
|
|
63
|
+
it('should return last line is empty', () => {
|
|
64
|
+
const d = { A: [null, null], B: ['b', null] };
|
|
65
|
+
const iv = [{ name: 'A' }, { name: 'B' }];
|
|
66
|
+
expect(U.lastLoopChildLineIsEmpty(d)(iv)).toBeTruthy();
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
describe('buildEmptyValue', () => {
|
|
71
|
+
it('should return default value', () => {
|
|
72
|
+
expect(U.buildEmptyValue()).toBeNull();
|
|
73
|
+
expect(U.buildEmptyValue(0)).toBeNull();
|
|
74
|
+
expect(U.buildEmptyValue(1)).toBeNull();
|
|
75
|
+
expect(U.buildEmptyValue(2)).toBeNull();
|
|
76
|
+
});
|
|
77
|
+
it('should return null array thanks to depth', () => {
|
|
78
|
+
expect(U.buildEmptyValue(3)).toEqual([null]);
|
|
79
|
+
expect(U.buildEmptyValue(4)).toEqual([[null]]);
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
});
|
|
@@ -1,74 +1,74 @@
|
|
|
1
|
-
import * as U from 'utils/lib';
|
|
2
|
-
import * as M from './mock';
|
|
3
|
-
|
|
4
|
-
describe('buildLoopMissingResponse', () => {
|
|
5
|
-
it('should return default value', () => {
|
|
6
|
-
expect(U.buildLoopMissingResponse()({})).toBeUndefined();
|
|
7
|
-
expect(U.buildLoopMissingResponse(0)()).toBeUndefined();
|
|
8
|
-
});
|
|
9
|
-
it('should return new missingResponse', () => {
|
|
10
|
-
expect(
|
|
11
|
-
U.buildLoopMissingResponse([1])({
|
|
12
|
-
name: 'var',
|
|
13
|
-
values: { COLLECTED: [null, 1], EDITED: [null, 2] },
|
|
14
|
-
})
|
|
15
|
-
).toEqual({
|
|
16
|
-
name: 'var',
|
|
17
|
-
values: { COLLECTED: 1, EDITED: 2 },
|
|
18
|
-
});
|
|
19
|
-
expect(
|
|
20
|
-
U.buildLoopMissingResponse([0])({
|
|
21
|
-
name: 'var',
|
|
22
|
-
values: { COLLECTED: [null, 1], EDITED: [null, 2] },
|
|
23
|
-
})
|
|
24
|
-
).toEqual({
|
|
25
|
-
name: 'var',
|
|
26
|
-
values: { COLLECTED: null, EDITED: null },
|
|
27
|
-
});
|
|
28
|
-
});
|
|
29
|
-
it('should return getToClean for response', () => {
|
|
30
|
-
expect(U.getToClean('COLLECTED')(M.qRespTrue)).toEqual({
|
|
31
|
-
response: null,
|
|
32
|
-
});
|
|
33
|
-
expect(U.getToClean('COLLECTED')(M.qRespFalse)).toEqual({});
|
|
34
|
-
});
|
|
35
|
-
it('should return getToClean for responses', () => {
|
|
36
|
-
expect(U.getToClean('COLLECTED')(M.qRespsTrue)).toEqual({
|
|
37
|
-
response1: null,
|
|
38
|
-
response2: null,
|
|
39
|
-
});
|
|
40
|
-
expect(U.getToClean('COLLECTED')(M.qRespsFalse)).toEqual({});
|
|
41
|
-
});
|
|
42
|
-
it('should return getToClean for cells', () => {
|
|
43
|
-
expect(U.getToClean('COLLECTED')(M.qCellsTrue)).toEqual({
|
|
44
|
-
response2: null,
|
|
45
|
-
});
|
|
46
|
-
expect(U.getToClean('COLLECTED')(M.qCellsFalse)).toEqual({});
|
|
47
|
-
});
|
|
48
|
-
it('should return getToClean for components', () => {
|
|
49
|
-
expect(U.getToClean('COLLECTED')(M.qComponentsTrue)).toEqual({
|
|
50
|
-
response2: [
|
|
51
|
-
[null, null],
|
|
52
|
-
[null, null],
|
|
53
|
-
],
|
|
54
|
-
response3: null,
|
|
55
|
-
});
|
|
56
|
-
expect(U.getToClean('COLLECTED')(M.qComponentsFalse)).toEqual({});
|
|
57
|
-
});
|
|
58
|
-
it('should return hasToCleanMissing for response', () => {
|
|
59
|
-
expect(U.hasToCleanMissing('COLLECTED')(M.qRespTrue)).toBeTruthy();
|
|
60
|
-
expect(U.hasToCleanMissing('COLLECTED')(M.qRespFalse)).toBeFalsy();
|
|
61
|
-
});
|
|
62
|
-
it('should return hasToCleanMissing for responses', () => {
|
|
63
|
-
expect(U.hasToCleanMissing('COLLECTED')(M.qRespsTrue)).toBeTruthy();
|
|
64
|
-
expect(U.hasToCleanMissing('COLLECTED')(M.qRespsFalse)).toBeFalsy();
|
|
65
|
-
});
|
|
66
|
-
it('should return hasToCleanMissing for cells', () => {
|
|
67
|
-
expect(U.hasToCleanMissing('COLLECTED')(M.qCellsTrue)).toBeTruthy();
|
|
68
|
-
expect(U.hasToCleanMissing('COLLECTED')(M.qCellsFalse)).toBeFalsy();
|
|
69
|
-
});
|
|
70
|
-
it('should return hasToCleanMissing for components', () => {
|
|
71
|
-
expect(U.hasToCleanMissing('COLLECTED')(M.qComponentsTrue)).toBeTruthy();
|
|
72
|
-
expect(U.hasToCleanMissing('COLLECTED')(M.qComponentsFalse)).toBeFalsy();
|
|
73
|
-
});
|
|
74
|
-
});
|
|
1
|
+
import * as U from 'utils/lib';
|
|
2
|
+
import * as M from './mock';
|
|
3
|
+
|
|
4
|
+
describe('buildLoopMissingResponse', () => {
|
|
5
|
+
it('should return default value', () => {
|
|
6
|
+
expect(U.buildLoopMissingResponse()({})).toBeUndefined();
|
|
7
|
+
expect(U.buildLoopMissingResponse(0)()).toBeUndefined();
|
|
8
|
+
});
|
|
9
|
+
it('should return new missingResponse', () => {
|
|
10
|
+
expect(
|
|
11
|
+
U.buildLoopMissingResponse([1])({
|
|
12
|
+
name: 'var',
|
|
13
|
+
values: { COLLECTED: [null, 1], EDITED: [null, 2] },
|
|
14
|
+
})
|
|
15
|
+
).toEqual({
|
|
16
|
+
name: 'var',
|
|
17
|
+
values: { COLLECTED: 1, EDITED: 2 },
|
|
18
|
+
});
|
|
19
|
+
expect(
|
|
20
|
+
U.buildLoopMissingResponse([0])({
|
|
21
|
+
name: 'var',
|
|
22
|
+
values: { COLLECTED: [null, 1], EDITED: [null, 2] },
|
|
23
|
+
})
|
|
24
|
+
).toEqual({
|
|
25
|
+
name: 'var',
|
|
26
|
+
values: { COLLECTED: null, EDITED: null },
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
it('should return getToClean for response', () => {
|
|
30
|
+
expect(U.getToClean('COLLECTED')(M.qRespTrue)).toEqual({
|
|
31
|
+
response: null,
|
|
32
|
+
});
|
|
33
|
+
expect(U.getToClean('COLLECTED')(M.qRespFalse)).toEqual({});
|
|
34
|
+
});
|
|
35
|
+
it('should return getToClean for responses', () => {
|
|
36
|
+
expect(U.getToClean('COLLECTED')(M.qRespsTrue)).toEqual({
|
|
37
|
+
response1: null,
|
|
38
|
+
response2: null,
|
|
39
|
+
});
|
|
40
|
+
expect(U.getToClean('COLLECTED')(M.qRespsFalse)).toEqual({});
|
|
41
|
+
});
|
|
42
|
+
it('should return getToClean for cells', () => {
|
|
43
|
+
expect(U.getToClean('COLLECTED')(M.qCellsTrue)).toEqual({
|
|
44
|
+
response2: null,
|
|
45
|
+
});
|
|
46
|
+
expect(U.getToClean('COLLECTED')(M.qCellsFalse)).toEqual({});
|
|
47
|
+
});
|
|
48
|
+
it('should return getToClean for components', () => {
|
|
49
|
+
expect(U.getToClean('COLLECTED')(M.qComponentsTrue)).toEqual({
|
|
50
|
+
response2: [
|
|
51
|
+
[null, null],
|
|
52
|
+
[null, null],
|
|
53
|
+
],
|
|
54
|
+
response3: null,
|
|
55
|
+
});
|
|
56
|
+
expect(U.getToClean('COLLECTED')(M.qComponentsFalse)).toEqual({});
|
|
57
|
+
});
|
|
58
|
+
it('should return hasToCleanMissing for response', () => {
|
|
59
|
+
expect(U.hasToCleanMissing('COLLECTED')(M.qRespTrue)).toBeTruthy();
|
|
60
|
+
expect(U.hasToCleanMissing('COLLECTED')(M.qRespFalse)).toBeFalsy();
|
|
61
|
+
});
|
|
62
|
+
it('should return hasToCleanMissing for responses', () => {
|
|
63
|
+
expect(U.hasToCleanMissing('COLLECTED')(M.qRespsTrue)).toBeTruthy();
|
|
64
|
+
expect(U.hasToCleanMissing('COLLECTED')(M.qRespsFalse)).toBeFalsy();
|
|
65
|
+
});
|
|
66
|
+
it('should return hasToCleanMissing for cells', () => {
|
|
67
|
+
expect(U.hasToCleanMissing('COLLECTED')(M.qCellsTrue)).toBeTruthy();
|
|
68
|
+
expect(U.hasToCleanMissing('COLLECTED')(M.qCellsFalse)).toBeFalsy();
|
|
69
|
+
});
|
|
70
|
+
it('should return hasToCleanMissing for components', () => {
|
|
71
|
+
expect(U.hasToCleanMissing('COLLECTED')(M.qComponentsTrue)).toBeTruthy();
|
|
72
|
+
expect(U.hasToCleanMissing('COLLECTED')(M.qComponentsFalse)).toBeFalsy();
|
|
73
|
+
});
|
|
74
|
+
});
|