@sis-cc/dotstatsuite-components 9.1.2 → 9.2.2

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.
Files changed (77) hide show
  1. package/lib/rules/src/preparators/enhanceObservations.js +155 -0
  2. package/lib/rules/src/preparators/formatValue.js +77 -0
  3. package/lib/rules/src/preparators/getDimensions.js +55 -0
  4. package/lib/rules/src/preparators/getDisplay.js +32 -0
  5. package/lib/rules/src/preparators/getObservations.js +27 -0
  6. package/lib/rules/src/table/factories/getCells.js +1 -3
  7. package/lib/rules/src/table/factories/getLayoutData.js +118 -159
  8. package/lib/rules/src/table/factories/getSortedLayoutIndexes.js +118 -0
  9. package/lib/rules/src/table/factories/getTableData.js +12 -10
  10. package/lib/rules/src/table/factories/refineLayoutSize.js +210 -0
  11. package/lib/rules/src/table/preparators/prepareData.js +23 -23
  12. package/lib/rules/src/table/units/getAttachmentSeriesIndexes.js +1 -1
  13. package/lib/rules/src/table/units/getUnitsSeries.js +31 -0
  14. package/lib/rules/src/v8-transformer.js +2 -1
  15. package/package.json +2 -2
  16. package/src/rules/src/preparators/enhanceObservations.js +163 -0
  17. package/src/rules/src/preparators/formatValue.js +73 -0
  18. package/src/rules/src/preparators/getDimensions.js +49 -0
  19. package/src/rules/src/preparators/getDisplay.js +20 -0
  20. package/src/rules/src/preparators/getObservations.js +19 -0
  21. package/src/rules/src/table/factories/getCells.js +3 -7
  22. package/src/rules/src/table/factories/getLayoutData.js +150 -184
  23. package/src/rules/src/table/factories/getSortedLayoutIndexes.js +108 -0
  24. package/src/rules/src/table/factories/getTableData.js +10 -10
  25. package/src/rules/src/table/factories/refineLayoutSize.js +224 -0
  26. package/src/rules/src/table/preparators/prepareData.js +23 -32
  27. package/src/rules/src/table/units/getAttachmentSeriesIndexes.js +2 -1
  28. package/src/rules/src/table/units/getUnitsSeries.js +20 -0
  29. package/src/rules/src/v8-transformer.js +2 -1
  30. package/test/appendUnitsInLayoutDataEntry.test.js +3 -3
  31. package/test/enhanceObservations.test.js +270 -0
  32. package/test/getAttachmentSeriesIndexes.test.js +1 -1
  33. package/test/getCells.test.js +4 -39
  34. package/test/getLayoutData.test.js +193 -298
  35. package/test/getOneValueDimensions.test.js +1 -1
  36. package/test/getSortedLayoutIndexes.test.js +80 -0
  37. package/test/getUnitsArtefacts.test.js +1 -1
  38. package/test/getUnitsSeries.test.js +64 -0
  39. package/test/mocks/table-layout-multi-hierarchies--layout.json +621 -0
  40. package/test/mocks/table-layout-multi-hierarchies--layoutData.json +32410 -0
  41. package/test/mocks/table-layout-multi-hierarchies--layoutIndexes.json +2760 -0
  42. package/test/mocks/table-layout-multi-hierarchies--observations.json +30688 -0
  43. package/test/mocks/table-layout-multi-hierarchies--sizedIndexes.json +2761 -0
  44. package/test/mocks/table-layout-truncation1--layout.json +27469 -0
  45. package/test/mocks/table-layout-truncation1--layoutData.json +20357 -0
  46. package/test/mocks/table-layout-truncation1--layoutIndexes.json +7512 -0
  47. package/test/mocks/table-layout-truncation1--observations.json +70002 -0
  48. package/test/mocks/table-layout-truncation1--sizedIndexes.json +3010 -0
  49. package/test/mocks/table-prep-multi-hierarchies--attributes.json +44 -0
  50. package/test/mocks/table-prep-multi-hierarchies--dimensions.json +688 -0
  51. package/test/mocks/table-prep-multi-hierarchies--enhancedObservations.json +19696 -0
  52. package/test/mocks/table-prep-multi-hierarchies--observations.json +8246 -0
  53. package/test/mocks/table-prep-multi-hierarchies--sdmxJson.json +2985 -0
  54. package/test/mocks/table-prep-truncation1--dimensions.json +35057 -0
  55. package/test/mocks/table-prep-truncation1--enhancedObservations.json +70002 -0
  56. package/test/mocks/table-prep-truncation1--observations.json +27502 -0
  57. package/test/mocks/table-prep-truncation1--sdmxJson.json +55103 -0
  58. package/test/mocks/table-prep-units--observations.json +284286 -0
  59. package/test/mocks/table-prep-units--unitsSeries.json +41042 -0
  60. package/test/parseAttributes.test.js +1 -1
  61. package/test/refineLayoutSize.test.js +415 -0
  62. package/test/table-layout-perf.test.js +74 -0
  63. package/test/table-prep-perf.test.js +65 -0
  64. package/lib/rules/src/table/factories/getSortedLayoutData.js +0 -145
  65. package/lib/rules/src/table/factories/refineLayoutHierarchy.js +0 -61
  66. package/lib/rules/src/table/preparators/parseObservations.js +0 -76
  67. package/lib/rules/src/table/units/getUnitsSeriesOccurences.js +0 -39
  68. package/src/rules/src/table/factories/getSortedLayoutData.js +0 -133
  69. package/src/rules/src/table/factories/refineLayoutHierarchy.js +0 -64
  70. package/src/rules/src/table/preparators/parseObservations.js +0 -81
  71. package/src/rules/src/table/units/getUnitsSeriesOccurences.js +0 -51
  72. package/test/appendUnitsInLayoutData.test.js +0 -248
  73. package/test/getSortedLayoutData.test.js +0 -382
  74. package/test/getUnitsSeriesOccurences.test.js +0 -133
  75. package/test/parseObservations.test.js +0 -116
  76. package/test/refineDimSeriesUnits.test.js +0 -24
  77. package/test/refineLayoutHierarchy.test.js +0 -79
@@ -1,248 +0,0 @@
1
- import { expect } from 'chai';
2
- import { appendUnitsInLayoutData } from '../src/rules/src/table/units/appendUnitsInLayoutData';
3
-
4
- const headerData = [
5
- [
6
- { dimension: { id: 'H1', __index: 0 }, value: { id: 'H1V1', __index: 0 } },
7
- { dimension: { id: 'H2', __index: 2 }, value: { id: 'H2V1', __index: 0 } },
8
- ],[
9
- { dimension: { id: 'H1', __index: 0 }, value: { id: 'H1V2', __index: 1 } },
10
- { dimension: { id: 'H2', __index: 2 }, value: { id: 'H2V2', __index: 1 } }
11
- ],
12
- ];
13
-
14
- const sectionsData = [
15
- [
16
- [
17
- { dimension: { id: 'S1', __index: 1 }, value: { id: 'S1V1', __index: 0 } },
18
- { dimension: { id: 'S2', __index: 3 }, value: { id: 'S2V1', __index: 0 } },
19
- ],
20
- [
21
- [
22
- { dimension: { id: 'R1', __index: 4 }, value: { id: 'R1V1', __index: 0 } },
23
- { dimension: { id: 'R2', __index: 5 }, value: { id: 'R1V1', __index: 0 } }
24
- ],
25
- [
26
- { dimension: { id: 'R1', __index: 4 }, value: { id: 'R1V1', __index: 1 } },
27
- { dimension: { id: 'R2', __index: 5 }, value: { id: 'R1V1', __index: 1 } }
28
- ]
29
- ]
30
- ],
31
- [
32
- [
33
- { dimension: { id: 'S1', __index: 1 }, value: { id: 'S1V1', __index: 1 } },
34
- { dimension: { id: 'S2', __index: 3 }, value: { id: 'S2V1', __index: 1 } },
35
- ],
36
- [
37
- [
38
- { dimension: { id: 'R1', __index: 4 }, value: { id: 'R1V1', __index: 0 } },
39
- { dimension: { id: 'R2', __index: 5 }, value: { id: 'R1V1', __index: 0 } }
40
- ],
41
- [
42
- { dimension: { id: 'R1', __index: 4 }, value: { id: 'R1V1', __index: 1 } },
43
- { dimension: { id: 'R2', __index: 5 }, value: { id: 'R1V1', __index: 1 } }
44
- ]
45
- ]
46
- ],
47
- ];
48
-
49
- const unitsSeries = {
50
- "0:x:0:x:x:x": { U1: { id: 'U1', value: { id: 'U1V1' } } },
51
- "1:x:1:x:x:x": { U1: { id: 'U1', value: { id: 'U1V2' } } },
52
- "x:0:x:0:x:x": { U2: { id: 'U2', value: { id: 'U2V1' } } },
53
- "x:1:x:1:x:x": { U2: { id: 'U2', value: { id: 'U2V2' } } },
54
- "x:x:x:x:0:0": { U3: { id: 'U3', value: { id: 'U3V1' } } },
55
- "x:x:x:x:1:1": { U3: { id: 'U3', value: { id: 'U3V2' } } },
56
- "x:0:x:x:0:0": { U4: { id: 'U4', value: { id: 'U4V1' } } },
57
- "x:1:x:x:1:1": { U4: { id: 'U4', value: { id: 'U4V2' } } }
58
- };
59
-
60
- describe('appendUnitsInLayoutData tests', () => {
61
- it('blank test', () => {
62
- expect(appendUnitsInLayoutData({
63
- display: 'label',
64
- unitDimension: {},
65
- unitsDisplay: 'header',
66
- unitsSeries: {},
67
- unitsDefinitionCodes: [],
68
- unitsIndexes: {}, // { header: [], sections: [], rows: [] }
69
- partialUnitSerieIndexes: [],
70
- layoutIds: {}
71
- })({})).to.deep.equal({});
72
- });
73
- it('header test', () => {
74
- expect(appendUnitsInLayoutData({
75
- display: 'code',
76
- unitDimension: { id: 'U' },
77
- unitsDisplay: 'header',
78
- unitsSeries,
79
- unitsDefinitionCodes: ['U1'],
80
- unitsIndexes: { header: [0, 1] }, // { header: [], sections: [], rows: [] }
81
- partialUnitSerieIndexes: ['x', 'x', 'x', 'x', 'x', 'x'],
82
- layoutIds: {}
83
- })({ headerData })).to.deep.equal({
84
- headerData: [
85
- [
86
- { dimension: { id: 'H1', __index: 0 }, value: { id: 'H1V1', __index: 0 } },
87
- { dimension: { id: 'H2', __index: 2 }, value: { id: 'H2V1', __index: 0 } },
88
- { dimension: { id: 'U' }, value: { id: 'VAL', unitsLabel: 'U1V1' } },
89
- ],[
90
- { dimension: { id: 'H1', __index: 0 }, value: { id: 'H1V2', __index: 1 } },
91
- { dimension: { id: 'H2', __index: 2 }, value: { id: 'H2V2', __index: 1 } },
92
- { dimension: { id: 'U' }, value: { id: 'VAL', unitsLabel: 'U1V2' } },
93
- ],
94
- ]
95
- });
96
- });
97
- it('sections test', () => {
98
- expect(appendUnitsInLayoutData({
99
- display: 'code',
100
- unitDimension: { id: 'U' },
101
- unitsDisplay: 'sections',
102
- unitsSeries,
103
- unitsDefinitionCodes: ['U2'],
104
- unitsIndexes: { sections: [0, 1] }, // { header: [], sections: [], rows: [] }
105
- partialUnitSerieIndexes: ['x', 'x', 'x', 'x', 'x', 'x'],
106
- layoutIds: {},
107
- })({ sectionsData })).to.deep.equal({
108
- sectionsData: [
109
- [
110
- [
111
- { dimension: { id: 'S1', __index: 1 }, value: { id: 'S1V1', __index: 0 } },
112
- { dimension: { id: 'S2', __index: 3 }, value: { id: 'S2V1', __index: 0 } },
113
- { dimension: { id: 'U' }, value: { id: 'VAL', unitsLabel: 'U2V1' } },
114
- ],
115
- [
116
- [
117
- { dimension: { id: 'R1', __index: 4 }, value: { id: 'R1V1', __index: 0 } },
118
- { dimension: { id: 'R2', __index: 5 }, value: { id: 'R1V1', __index: 0 } }
119
- ],
120
- [
121
- { dimension: { id: 'R1', __index: 4 }, value: { id: 'R1V1', __index: 1 } },
122
- { dimension: { id: 'R2', __index: 5 }, value: { id: 'R1V1', __index: 1 } }
123
- ]
124
- ]
125
- ],
126
- [
127
- [
128
- { dimension: { id: 'S1', __index: 1 }, value: { id: 'S1V1', __index: 1 } },
129
- { dimension: { id: 'S2', __index: 3 }, value: { id: 'S2V1', __index: 1 } },
130
- { dimension: { id: 'U' }, value: { id: 'VAL', unitsLabel: 'U2V2' } },
131
- ],
132
- [
133
- [
134
- { dimension: { id: 'R1', __index: 4 }, value: { id: 'R1V1', __index: 0 } },
135
- { dimension: { id: 'R2', __index: 5 }, value: { id: 'R1V1', __index: 0 } }
136
- ],
137
- [
138
- { dimension: { id: 'R1', __index: 4 }, value: { id: 'R1V1', __index: 1 } },
139
- { dimension: { id: 'R2', __index: 5 }, value: { id: 'R1V1', __index: 1 } }
140
- ]
141
- ]
142
- ],
143
- ]
144
- });
145
- });
146
- it('rows test', () => {
147
- expect(appendUnitsInLayoutData({
148
- display: 'code',
149
- unitDimension: { id: 'U' },
150
- unitsDisplay: 'rows',
151
- unitsSeries,
152
- unitsDefinitionCodes: ['U3'],
153
- unitsIndexes: { rows: [0, 1], sections: [] }, // { header: [], sections: [], rows: [] }
154
- partialUnitSerieIndexes: ['x', 'x', 'x', 'x', 'x', 'x'],
155
- layoutIds: { sections: ['S1', 'S2'] }
156
- })({ sectionsData })).to.deep.equal({
157
- sectionsData: [
158
- [
159
- [
160
- { dimension: { id: 'S1', __index: 1 }, value: { id: 'S1V1', __index: 0 } },
161
- { dimension: { id: 'S2', __index: 3 }, value: { id: 'S2V1', __index: 0 } }
162
- ],
163
- [
164
- [
165
- { dimension: { id: 'R1', __index: 4 }, value: { id: 'R1V1', __index: 0 } },
166
- { dimension: { id: 'R2', __index: 5 }, value: { id: 'R1V1', __index: 0 } },
167
- { dimension: { id: 'U' }, value: { id: 'VAL', unitsLabel: 'U3V1' } },
168
- ],
169
- [
170
- { dimension: { id: 'R1', __index: 4 }, value: { id: 'R1V1', __index: 1 } },
171
- { dimension: { id: 'R2', __index: 5 }, value: { id: 'R1V1', __index: 1 } },
172
- { dimension: { id: 'U' }, value: { id: 'VAL', unitsLabel: 'U3V2' } },
173
- ]
174
- ]
175
- ],
176
- [
177
- [
178
- { dimension: { id: 'S1', __index: 1 }, value: { id: 'S1V1', __index: 1 } },
179
- { dimension: { id: 'S2', __index: 3 }, value: { id: 'S2V1', __index: 1 } },
180
- ],
181
- [
182
- [
183
- { dimension: { id: 'R1', __index: 4 }, value: { id: 'R1V1', __index: 0 } },
184
- { dimension: { id: 'R2', __index: 5 }, value: { id: 'R1V1', __index: 0 } },
185
- { dimension: { id: 'U' }, value: { id: 'VAL', unitsLabel: 'U3V1' } },
186
- ],
187
- [
188
- { dimension: { id: 'R1', __index: 4 }, value: { id: 'R1V1', __index: 1 } },
189
- { dimension: { id: 'R2', __index: 5 }, value: { id: 'R1V1', __index: 1 } },
190
- { dimension: { id: 'U' }, value: { id: 'VAL', unitsLabel: 'U3V2' } },
191
- ]
192
- ]
193
- ],
194
- ]
195
- });
196
- });
197
- it('rows and sections test', () => {
198
- expect(appendUnitsInLayoutData({
199
- display: 'code',
200
- unitDimension: { id: 'U' },
201
- unitsDisplay: 'rows',
202
- unitsSeries,
203
- unitsDefinitionCodes: ['U4'],
204
- unitsIndexes: { rows: [0, 1], sections: [0] }, // { header: [], sections: [], rows: [] }
205
- partialUnitSerieIndexes: ['x', 'x', 'x', 'x', 'x', 'x'],
206
- layoutIds: { sections: ['S1', 'S2'] }
207
- })({ sectionsData })).to.deep.equal({
208
- sectionsData: [
209
- [
210
- [
211
- { dimension: { id: 'S1', __index: 1 }, value: { id: 'S1V1', __index: 0 } },
212
- { dimension: { id: 'S2', __index: 3 }, value: { id: 'S2V1', __index: 0 } }
213
- ],
214
- [
215
- [
216
- { dimension: { id: 'R1', __index: 4 }, value: { id: 'R1V1', __index: 0 } },
217
- { dimension: { id: 'R2', __index: 5 }, value: { id: 'R1V1', __index: 0 } },
218
- { dimension: { id: 'U' }, value: { id: 'VAL', unitsLabel: 'U4V1' } },
219
- ],
220
- [
221
- { dimension: { id: 'R1', __index: 4 }, value: { id: 'R1V1', __index: 1 } },
222
- { dimension: { id: 'R2', __index: 5 }, value: { id: 'R1V1', __index: 1 } },
223
- { dimension: { id: 'U' }, value: { id: 'VAL', unitsLabel: '' } },
224
- ]
225
- ]
226
- ],
227
- [
228
- [
229
- { dimension: { id: 'S1', __index: 1 }, value: { id: 'S1V1', __index: 1 } },
230
- { dimension: { id: 'S2', __index: 3 }, value: { id: 'S2V1', __index: 1 } },
231
- ],
232
- [
233
- [
234
- { dimension: { id: 'R1', __index: 4 }, value: { id: 'R1V1', __index: 0 } },
235
- { dimension: { id: 'R2', __index: 5 }, value: { id: 'R1V1', __index: 0 } },
236
- { dimension: { id: 'U' }, value: { id: 'VAL', unitsLabel: '' } },
237
- ],
238
- [
239
- { dimension: { id: 'R1', __index: 4 }, value: { id: 'R1V1', __index: 1 } },
240
- { dimension: { id: 'R2', __index: 5 }, value: { id: 'R1V1', __index: 1 } },
241
- { dimension: { id: 'U' }, value: { id: 'VAL', unitsLabel: 'U4V2' } },
242
- ]
243
- ]
244
- ],
245
- ]
246
- });
247
- });
248
- });
@@ -1,382 +0,0 @@
1
- import { expect } from 'chai';
2
- import { getSortedLayoutData } from '../src/rules/src/table/factories/getSortedLayoutData';
3
- import * as R from 'ramda';
4
-
5
- const d1 = { id: 'D1', name: 'D1', __index: 0 };
6
- const d1v1 = { id: 'D1V1', name: 'D1V1', __index: 0, __indexPosition: 0 };
7
- const d1v2 = { id: 'D1V2', name: 'D1V2', __index: 1, __indexPosition: 1 };
8
- const d1v3 = { id: 'D1V3', name: 'D1V3', __index: 2, __indexPosition: 2 };
9
- const d1v1Layout = { dimension: d1, value: d1v1 };
10
- const d1v2Layout = { dimension: d1, value: d1v2 };
11
- const d1v3Layout = { dimension: d1, value: d1v3 };
12
- const dimension1 = { ...d1, values: [d1v1, d1v2, d1v3] };
13
- const reordedDimension1 = { ...d1, values: [
14
- { ...d1v2, __indexPosition: 0 },
15
- { ...d1v3, __indexPosition: 1 },
16
- { ...d1v1, __indexPosition: 2 }
17
- ] };
18
-
19
- const d2 = { id: 'D2', name: 'D2', __index: 1 };
20
- const d2v1 = { id: 'D2V1', name: 'D2V1', __index: 0, __indexPosition: 0 };
21
- const d2v2 = { id: 'D2V2', name: 'D2V2', __index: 1, __indexPosition: 1 };
22
- const d2v3 = { id: 'D2V3', name: 'D2V3', __index: 2, __indexPosition: 2 };
23
- const d2v1Layout = { dimension: d2, value: d2v1 };
24
- const d2v2Layout = { dimension: d2, value: d2v2 };
25
- const d2v3Layout = { dimension: d2, value: d2v3 };
26
- const dimension2 = { ...d2, values: [d2v1, d2v2, d2v3] };
27
- const reordedDimension2 = { ...d2, values: [
28
- { ...d2v3, __indexPosition: 0 },
29
- { ...d2v1, __indexPosition: 1 },
30
- { ...d2v2, __indexPosition: 2 }
31
- ] };
32
-
33
- const d3 = { id: 'D3', name: 'D3', __index: 2 };
34
- const d3v1 = { id: 'D3V1', name: 'D3V1', __index: 0, __indexPosition: 0 };
35
- const d3v2 = { id: 'D3V2', name: 'D3V2', __index: 1, __indexPosition: 1 };
36
- const d3v3 = { id: 'D3V3', name: 'D3V3', __index: 2, __indexPosition: 2 };
37
- const d3v1Layout = { dimension: d3, value: d3v1 };
38
- const d3v2Layout = { dimension: d3, value: d3v2 };
39
- const d3v3Layout = { dimension: d3, value: d3v3 };
40
- const dimension3 = { ...d3, values: [d3v1, d3v2, d3v3] };
41
- const reordedDimension3 = { ...d3, values: [
42
- { ...d3v1, __indexPosition: 2 },
43
- { ...d3v2, __indexPosition: 1 },
44
- { ...d3v3, __indexPosition: 0 }
45
- ] };
46
-
47
- const reorderLayout = (index) => R.set(R.lensPath(['value', '__indexPosition']), index);
48
-
49
- const simpleLayout = {
50
- header: [dimension1],
51
- rows: [dimension2],
52
- sections: [dimension3]
53
- };
54
-
55
- const emptyHeadersLayout = {
56
- header: [],
57
- rows: [dimension2, dimension1],
58
- sections: [dimension3]
59
- };
60
-
61
- const emptySectionsLayout = {
62
- header: [dimension1],
63
- rows: [dimension3, dimension2],
64
- sections: [],
65
- };
66
-
67
- const reordedSimpleLayout = {
68
- header: [reordedDimension1],
69
- rows: [reordedDimension2],
70
- sections: [reordedDimension3]
71
- };
72
-
73
- const onlyRowsLayout = {
74
- header: [],
75
- rows: [reordedDimension2, reordedDimension3, reordedDimension1],
76
- sections: []
77
- };
78
-
79
- const onlyHeaderLayout = {
80
- header: [reordedDimension2, reordedDimension3, reordedDimension1],
81
- rows: [],
82
- sections: []
83
- };
84
-
85
- const observations = {
86
- '0:0:0': [],
87
- '0:0:1': [],
88
- '0:0:2': [],
89
- '0:1:0': [],
90
- '0:1:1': [],
91
- '0:1:2': [],
92
- '0:2:0': [],
93
- '0:2:1': [],
94
- '0:2:2': [],
95
- '1:0:0': [],
96
- '1:0:1': [],
97
- '1:0:2': [],
98
- '1:1:0': [],
99
- '1:1:1': [],
100
- '1:1:2': [],
101
- '1:2:0': [],
102
- '1:2:1': [],
103
- '1:2:2': [],
104
- '2:0:0': [],
105
- '2:0:1': [],
106
- '2:0:2': [],
107
- '2:1:0': [],
108
- '2:1:1': [],
109
- '2:1:2': [],
110
- '2:2:0': [],
111
- '2:2:1': [],
112
- '2:2:2': [],
113
- };
114
-
115
- const partialObservations = {
116
- '0:0:0': [],
117
- '0:0:2': [],
118
- '0:1:0': [],
119
- '0:1:2': [],
120
- '0:2:2': [],
121
- '2:0:0': [],
122
- '2:0:2': [],
123
- '2:1:0': [],
124
- '2:1:2': [],
125
- '2:2:2': [],
126
- };
127
-
128
- describe('getSortedLayoutData tests', () => {
129
- it('simple basic case', () => {
130
- const headerData = [[d1v1Layout], [d1v2Layout], [d1v3Layout]];
131
-
132
- const sectionsData = [
133
- [
134
- [d3v1Layout],
135
- [[d2v1Layout], [d2v2Layout], [d2v3Layout]]
136
- ],
137
- [
138
- [d3v2Layout],
139
- [[d2v1Layout], [d2v2Layout], [d2v3Layout]]
140
- ],
141
- [
142
- [d3v3Layout],
143
- [[d2v1Layout], [d2v2Layout], [d2v3Layout]]
144
- ]
145
- ];
146
-
147
- expect(getSortedLayoutData(simpleLayout, observations)).to.deep.equal({ headerData, sectionsData });
148
- });
149
-
150
- it('no sections case', () => {
151
- const headerData = [[d1v1Layout], [d1v2Layout], [d1v3Layout]];
152
-
153
- const sectionsData = [
154
- [
155
- [],
156
- [
157
- [d3v1Layout, d2v1Layout],
158
- [d3v1Layout, d2v2Layout],
159
- [d3v1Layout, d2v3Layout],
160
- [d3v2Layout, d2v1Layout],
161
- [d3v2Layout, d2v2Layout],
162
- [d3v2Layout, d2v3Layout],
163
- [d3v3Layout, d2v1Layout],
164
- [d3v3Layout, d2v2Layout],
165
- [d3v3Layout, d2v3Layout]
166
- ]
167
- ]
168
- ];
169
-
170
- expect(getSortedLayoutData(emptySectionsLayout, observations)).to.deep.equal({ headerData, sectionsData });
171
- });
172
-
173
- it('no headers case', () => {
174
- const headerData = [[]];
175
-
176
- const sectionsData = [
177
- [
178
- [d3v1Layout],
179
- [
180
- [d2v1Layout, d1v1Layout],
181
- [d2v1Layout, d1v2Layout],
182
- [d2v1Layout, d1v3Layout],
183
- [d2v2Layout, d1v1Layout],
184
- [d2v2Layout, d1v2Layout],
185
- [d2v2Layout, d1v3Layout],
186
- [d2v3Layout, d1v1Layout],
187
- [d2v3Layout, d1v2Layout],
188
- [d2v3Layout, d1v3Layout]
189
- ]
190
- ],
191
- [
192
- [d3v2Layout],
193
- [
194
- [d2v1Layout, d1v1Layout],
195
- [d2v1Layout, d1v2Layout],
196
- [d2v1Layout, d1v3Layout],
197
- [d2v2Layout, d1v1Layout],
198
- [d2v2Layout, d1v2Layout],
199
- [d2v2Layout, d1v3Layout],
200
- [d2v3Layout, d1v1Layout],
201
- [d2v3Layout, d1v2Layout],
202
- [d2v3Layout, d1v3Layout]
203
- ]
204
- ],
205
- [
206
- [d3v3Layout],
207
- [
208
- [d2v1Layout, d1v1Layout],
209
- [d2v1Layout, d1v2Layout],
210
- [d2v1Layout, d1v3Layout],
211
- [d2v2Layout, d1v1Layout],
212
- [d2v2Layout, d1v2Layout],
213
- [d2v2Layout, d1v3Layout],
214
- [d2v3Layout, d1v1Layout],
215
- [d2v3Layout, d1v2Layout],
216
- [d2v3Layout, d1v3Layout]
217
- ]
218
- ],
219
- ];
220
-
221
- expect(getSortedLayoutData(emptyHeadersLayout, observations)).to.deep.equal({ headerData, sectionsData });
222
- });
223
-
224
- it('reorded dimensions case', () => {
225
- const headerData = [[reorderLayout(0)(d1v2Layout)], [reorderLayout(1)(d1v3Layout)], [reorderLayout(2)(d1v1Layout)]];
226
-
227
- const sectionsData = [
228
- [
229
- [reorderLayout(0)(d3v3Layout)],
230
- [[reorderLayout(0)(d2v3Layout)], [reorderLayout(1)(d2v1Layout)], [reorderLayout(2)(d2v2Layout)]]
231
- ],
232
- [
233
- [reorderLayout(1)(d3v2Layout)],
234
- [[reorderLayout(0)(d2v3Layout)], [reorderLayout(1)(d2v1Layout)], [reorderLayout(2)(d2v2Layout)]]
235
- ],
236
- [
237
- [reorderLayout(2)(d3v1Layout)],
238
- [[reorderLayout(0)(d2v3Layout)], [reorderLayout(1)(d2v1Layout)], [reorderLayout(2)(d2v2Layout)]]
239
- ]
240
- ];
241
-
242
- expect(getSortedLayoutData(reordedSimpleLayout, observations)).to.deep.equal({ headerData, sectionsData });
243
- });
244
-
245
- it('partial case', () => {
246
- const headerData = [[d1v1Layout], [d1v3Layout]];
247
-
248
- const sectionsData = [
249
- [
250
- [d3v1Layout],
251
- [[d2v1Layout], [d2v2Layout]]
252
- ],
253
- [
254
- [d3v3Layout],
255
- [[d2v1Layout], [d2v2Layout], [d2v3Layout]]
256
- ]
257
- ];
258
-
259
- expect(getSortedLayoutData(simpleLayout, partialObservations)).to.deep.equal({ headerData, sectionsData });
260
- });
261
-
262
- it('all reorded dimensions in rows', () => {
263
- const headerData = [[]];
264
-
265
- const sectionsData = [[
266
- [],
267
- [
268
- [reorderLayout(0)(d2v3Layout), reorderLayout(0)(d3v3Layout), reorderLayout(0)(d1v2Layout)],
269
- [reorderLayout(0)(d2v3Layout), reorderLayout(0)(d3v3Layout), reorderLayout(1)(d1v3Layout)],
270
- [reorderLayout(0)(d2v3Layout), reorderLayout(0)(d3v3Layout), reorderLayout(2)(d1v1Layout)],
271
- [reorderLayout(0)(d2v3Layout), reorderLayout(1)(d3v2Layout), reorderLayout(0)(d1v2Layout)],
272
- [reorderLayout(0)(d2v3Layout), reorderLayout(1)(d3v2Layout), reorderLayout(1)(d1v3Layout)],
273
- [reorderLayout(0)(d2v3Layout), reorderLayout(1)(d3v2Layout), reorderLayout(2)(d1v1Layout)],
274
- [reorderLayout(0)(d2v3Layout), reorderLayout(2)(d3v1Layout), reorderLayout(0)(d1v2Layout)],
275
- [reorderLayout(0)(d2v3Layout), reorderLayout(2)(d3v1Layout), reorderLayout(1)(d1v3Layout)],
276
- [reorderLayout(0)(d2v3Layout), reorderLayout(2)(d3v1Layout), reorderLayout(2)(d1v1Layout)],
277
- [reorderLayout(1)(d2v1Layout), reorderLayout(0)(d3v3Layout), reorderLayout(0)(d1v2Layout)],
278
- [reorderLayout(1)(d2v1Layout), reorderLayout(0)(d3v3Layout), reorderLayout(1)(d1v3Layout)],
279
- [reorderLayout(1)(d2v1Layout), reorderLayout(0)(d3v3Layout), reorderLayout(2)(d1v1Layout)],
280
- [reorderLayout(1)(d2v1Layout), reorderLayout(1)(d3v2Layout), reorderLayout(0)(d1v2Layout)],
281
- [reorderLayout(1)(d2v1Layout), reorderLayout(1)(d3v2Layout), reorderLayout(1)(d1v3Layout)],
282
- [reorderLayout(1)(d2v1Layout), reorderLayout(1)(d3v2Layout), reorderLayout(2)(d1v1Layout)],
283
- [reorderLayout(1)(d2v1Layout), reorderLayout(2)(d3v1Layout), reorderLayout(0)(d1v2Layout)],
284
- [reorderLayout(1)(d2v1Layout), reorderLayout(2)(d3v1Layout), reorderLayout(1)(d1v3Layout)],
285
- [reorderLayout(1)(d2v1Layout), reorderLayout(2)(d3v1Layout), reorderLayout(2)(d1v1Layout)],
286
- [reorderLayout(2)(d2v2Layout), reorderLayout(0)(d3v3Layout), reorderLayout(0)(d1v2Layout)],
287
- [reorderLayout(2)(d2v2Layout), reorderLayout(0)(d3v3Layout), reorderLayout(1)(d1v3Layout)],
288
- [reorderLayout(2)(d2v2Layout), reorderLayout(0)(d3v3Layout), reorderLayout(2)(d1v1Layout)],
289
- [reorderLayout(2)(d2v2Layout), reorderLayout(1)(d3v2Layout), reorderLayout(0)(d1v2Layout)],
290
- [reorderLayout(2)(d2v2Layout), reorderLayout(1)(d3v2Layout), reorderLayout(1)(d1v3Layout)],
291
- [reorderLayout(2)(d2v2Layout), reorderLayout(1)(d3v2Layout), reorderLayout(2)(d1v1Layout)],
292
- [reorderLayout(2)(d2v2Layout), reorderLayout(2)(d3v1Layout), reorderLayout(0)(d1v2Layout)],
293
- [reorderLayout(2)(d2v2Layout), reorderLayout(2)(d3v1Layout), reorderLayout(1)(d1v3Layout)],
294
- [reorderLayout(2)(d2v2Layout), reorderLayout(2)(d3v1Layout), reorderLayout(2)(d1v1Layout)]
295
- ]
296
- ]];
297
-
298
- expect(getSortedLayoutData(onlyRowsLayout, observations)).to.deep.equal({ headerData, sectionsData });
299
- });
300
-
301
- it('all reorded dimensions in header', () => {
302
- const headerData = [
303
- [reorderLayout(0)(d2v3Layout), reorderLayout(0)(d3v3Layout), reorderLayout(0)(d1v2Layout)],
304
- [reorderLayout(0)(d2v3Layout), reorderLayout(0)(d3v3Layout), reorderLayout(1)(d1v3Layout)],
305
- [reorderLayout(0)(d2v3Layout), reorderLayout(0)(d3v3Layout), reorderLayout(2)(d1v1Layout)],
306
- [reorderLayout(0)(d2v3Layout), reorderLayout(1)(d3v2Layout), reorderLayout(0)(d1v2Layout)],
307
- [reorderLayout(0)(d2v3Layout), reorderLayout(1)(d3v2Layout), reorderLayout(1)(d1v3Layout)],
308
- [reorderLayout(0)(d2v3Layout), reorderLayout(1)(d3v2Layout), reorderLayout(2)(d1v1Layout)],
309
- [reorderLayout(0)(d2v3Layout), reorderLayout(2)(d3v1Layout), reorderLayout(0)(d1v2Layout)],
310
- [reorderLayout(0)(d2v3Layout), reorderLayout(2)(d3v1Layout), reorderLayout(1)(d1v3Layout)],
311
- [reorderLayout(0)(d2v3Layout), reorderLayout(2)(d3v1Layout), reorderLayout(2)(d1v1Layout)],
312
- [reorderLayout(1)(d2v1Layout), reorderLayout(0)(d3v3Layout), reorderLayout(0)(d1v2Layout)],
313
- [reorderLayout(1)(d2v1Layout), reorderLayout(0)(d3v3Layout), reorderLayout(1)(d1v3Layout)],
314
- [reorderLayout(1)(d2v1Layout), reorderLayout(0)(d3v3Layout), reorderLayout(2)(d1v1Layout)],
315
- [reorderLayout(1)(d2v1Layout), reorderLayout(1)(d3v2Layout), reorderLayout(0)(d1v2Layout)],
316
- [reorderLayout(1)(d2v1Layout), reorderLayout(1)(d3v2Layout), reorderLayout(1)(d1v3Layout)],
317
- [reorderLayout(1)(d2v1Layout), reorderLayout(1)(d3v2Layout), reorderLayout(2)(d1v1Layout)],
318
- [reorderLayout(1)(d2v1Layout), reorderLayout(2)(d3v1Layout), reorderLayout(0)(d1v2Layout)],
319
- [reorderLayout(1)(d2v1Layout), reorderLayout(2)(d3v1Layout), reorderLayout(1)(d1v3Layout)],
320
- [reorderLayout(1)(d2v1Layout), reorderLayout(2)(d3v1Layout), reorderLayout(2)(d1v1Layout)],
321
- [reorderLayout(2)(d2v2Layout), reorderLayout(0)(d3v3Layout), reorderLayout(0)(d1v2Layout)],
322
- [reorderLayout(2)(d2v2Layout), reorderLayout(0)(d3v3Layout), reorderLayout(1)(d1v3Layout)],
323
- [reorderLayout(2)(d2v2Layout), reorderLayout(0)(d3v3Layout), reorderLayout(2)(d1v1Layout)],
324
- [reorderLayout(2)(d2v2Layout), reorderLayout(1)(d3v2Layout), reorderLayout(0)(d1v2Layout)],
325
- [reorderLayout(2)(d2v2Layout), reorderLayout(1)(d3v2Layout), reorderLayout(1)(d1v3Layout)],
326
- [reorderLayout(2)(d2v2Layout), reorderLayout(1)(d3v2Layout), reorderLayout(2)(d1v1Layout)],
327
- [reorderLayout(2)(d2v2Layout), reorderLayout(2)(d3v1Layout), reorderLayout(0)(d1v2Layout)],
328
- [reorderLayout(2)(d2v2Layout), reorderLayout(2)(d3v1Layout), reorderLayout(1)(d1v3Layout)],
329
- [reorderLayout(2)(d2v2Layout), reorderLayout(2)(d3v1Layout), reorderLayout(2)(d1v1Layout)]
330
- ];
331
-
332
- const sectionsData = [
333
- [
334
- [],
335
- [[]]
336
- ]
337
- ];
338
-
339
- expect(getSortedLayoutData(onlyHeaderLayout, observations)).to.deep.equal({ headerData, sectionsData });
340
- });
341
-
342
- it('reorded dimensions with partial observations', () => {
343
- const headerData = [[reorderLayout(1)(d1v3Layout)], [reorderLayout(2)(d1v1Layout)]];
344
-
345
- const sectionsData = [
346
- [
347
- [reorderLayout(0)(d3v3Layout)],
348
- [[reorderLayout(0)(d2v3Layout)], [reorderLayout(1)(d2v1Layout)], [reorderLayout(2)(d2v2Layout)]]
349
- ],
350
- [
351
- [reorderLayout(2)(d3v1Layout)],
352
- [[reorderLayout(1)(d2v1Layout)], [reorderLayout(2)(d2v2Layout)]]
353
- ]
354
- ];
355
-
356
- expect(getSortedLayoutData(reordedSimpleLayout, partialObservations)).to.deep.equal({ headerData, sectionsData });
357
- });
358
-
359
- it('all reorded dimensions in header with partial observations', () => {
360
- const headerData = [
361
- [reorderLayout(0)(d2v3Layout), reorderLayout(0)(d3v3Layout), reorderLayout(1)(d1v3Layout)],
362
- [reorderLayout(0)(d2v3Layout), reorderLayout(0)(d3v3Layout), reorderLayout(2)(d1v1Layout)],
363
- [reorderLayout(1)(d2v1Layout), reorderLayout(0)(d3v3Layout), reorderLayout(1)(d1v3Layout)],
364
- [reorderLayout(1)(d2v1Layout), reorderLayout(0)(d3v3Layout), reorderLayout(2)(d1v1Layout)],
365
- [reorderLayout(1)(d2v1Layout), reorderLayout(2)(d3v1Layout), reorderLayout(1)(d1v3Layout)],
366
- [reorderLayout(1)(d2v1Layout), reorderLayout(2)(d3v1Layout), reorderLayout(2)(d1v1Layout)],
367
- [reorderLayout(2)(d2v2Layout), reorderLayout(0)(d3v3Layout), reorderLayout(1)(d1v3Layout)],
368
- [reorderLayout(2)(d2v2Layout), reorderLayout(0)(d3v3Layout), reorderLayout(2)(d1v1Layout)],
369
- [reorderLayout(2)(d2v2Layout), reorderLayout(2)(d3v1Layout), reorderLayout(1)(d1v3Layout)],
370
- [reorderLayout(2)(d2v2Layout), reorderLayout(2)(d3v1Layout), reorderLayout(2)(d1v1Layout)]
371
- ];
372
-
373
- const sectionsData = [
374
- [
375
- [],
376
- [[]]
377
- ]
378
- ];
379
-
380
- expect(getSortedLayoutData(onlyHeaderLayout, partialObservations)).to.deep.equal({ headerData, sectionsData });
381
- });
382
- });