@sis-cc/dotstatsuite-components 9.1.0 → 9.2.0
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/rules/src/preparators/enhanceObservations.js +155 -0
- package/lib/rules/src/preparators/formatValue.js +77 -0
- package/lib/rules/src/preparators/getDimensions.js +55 -0
- package/lib/rules/src/preparators/getDisplay.js +32 -0
- package/lib/rules/src/preparators/getObservations.js +27 -0
- package/lib/rules/src/table/factories/getCells.js +1 -3
- package/lib/rules/src/table/factories/getLayoutData.js +102 -161
- package/lib/rules/src/table/factories/getSortedLayoutIndexes.js +118 -0
- package/lib/rules/src/table/factories/getTableData.js +12 -10
- package/lib/rules/src/table/factories/refineLayoutSize.js +210 -0
- package/lib/rules/src/table/preparators/prepareData.js +23 -23
- package/lib/rules/src/table/units/appendUnitsInLayoutDataEntry.js +10 -10
- package/lib/rules/src/table/units/getAttachmentSeriesIndexes.js +1 -1
- package/lib/rules/src/table/units/getUnitsSeries.js +31 -0
- package/lib/rules/src/v8-transformer.js +3 -2
- package/package.json +2 -2
- package/src/rules/src/preparators/enhanceObservations.js +163 -0
- package/src/rules/src/preparators/formatValue.js +73 -0
- package/src/rules/src/preparators/getDimensions.js +49 -0
- package/src/rules/src/preparators/getDisplay.js +20 -0
- package/src/rules/src/preparators/getObservations.js +19 -0
- package/src/rules/src/table/factories/getCells.js +3 -7
- package/src/rules/src/table/factories/getLayoutData.js +135 -184
- package/src/rules/src/table/factories/getSortedLayoutIndexes.js +108 -0
- package/src/rules/src/table/factories/getTableData.js +10 -10
- package/src/rules/src/table/factories/refineLayoutSize.js +224 -0
- package/src/rules/src/table/preparators/prepareData.js +23 -32
- package/src/rules/src/table/units/appendUnitsInLayoutDataEntry.js +15 -18
- package/src/rules/src/table/units/getAttachmentSeriesIndexes.js +2 -1
- package/src/rules/src/table/units/getUnitsSeries.js +20 -0
- package/src/rules/src/v8-transformer.js +4 -2
- package/test/appendUnitsInLayoutDataEntry.test.js +3 -3
- package/test/enhanceObservations.test.js +270 -0
- package/test/getAttachmentSeriesIndexes.test.js +1 -1
- package/test/getCells.test.js +4 -39
- package/test/getLayoutData2.test.js +194 -0
- package/test/getOneValueDimensions.test.js +1 -1
- package/test/getSortedLayoutIndexes.test.js +80 -0
- package/test/getUnitsArtefacts.test.js +1 -1
- package/test/getUnitsSeries.test.js +64 -0
- package/test/mocks/table-layout-multi-hierarchies--layout.json +621 -0
- package/test/mocks/table-layout-multi-hierarchies--layoutData.json +32410 -0
- package/test/mocks/table-layout-multi-hierarchies--layoutIndexes.json +2760 -0
- package/test/mocks/table-layout-multi-hierarchies--observations.json +30688 -0
- package/test/mocks/table-layout-multi-hierarchies--sizedIndexes.json +2761 -0
- package/test/mocks/table-layout-truncation1--layout.json +27469 -0
- package/test/mocks/table-layout-truncation1--layoutData.json +19413 -0
- package/test/mocks/table-layout-truncation1--layoutIndexes.json +7512 -0
- package/test/mocks/table-layout-truncation1--observations.json +70002 -0
- package/test/mocks/table-layout-truncation1--sizedIndexes.json +3010 -0
- package/test/mocks/table-prep-multi-hierarchies--attributes.json +44 -0
- package/test/mocks/table-prep-multi-hierarchies--dimensions.json +688 -0
- package/test/mocks/table-prep-multi-hierarchies--enhancedObservations.json +19696 -0
- package/test/mocks/table-prep-multi-hierarchies--observations.json +8246 -0
- package/test/mocks/table-prep-multi-hierarchies--sdmxJson.json +2985 -0
- package/test/mocks/table-prep-truncation1--dimensions.json +35057 -0
- package/test/mocks/table-prep-truncation1--enhancedObservations.json +70002 -0
- package/test/mocks/table-prep-truncation1--observations.json +27502 -0
- package/test/mocks/table-prep-truncation1--sdmxJson.json +55103 -0
- package/test/mocks/table-prep-units--observations.json +284286 -0
- package/test/mocks/table-prep-units--unitsSeries.json +41042 -0
- package/test/parseAttributes.test.js +1 -1
- package/test/refineLayoutSize.test.js +415 -0
- package/test/table-layout-perf.test.js +74 -0
- package/test/table-prep-perf.test.js +65 -0
- package/lib/rules/src/table/factories/getSortedLayoutData.js +0 -145
- package/lib/rules/src/table/factories/refineLayoutHierarchy.js +0 -61
- package/lib/rules/src/table/preparators/parseObservations.js +0 -76
- package/lib/rules/src/table/units/getUnitsSeriesOccurences.js +0 -39
- package/src/rules/src/table/factories/getSortedLayoutData.js +0 -133
- package/src/rules/src/table/factories/refineLayoutHierarchy.js +0 -64
- package/src/rules/src/table/preparators/parseObservations.js +0 -81
- package/src/rules/src/table/units/getUnitsSeriesOccurences.js +0 -51
- package/test/appendUnitsInLayoutData.test.js +0 -248
- package/test/getLayoutData.test.js +0 -311
- package/test/getSortedLayoutData.test.js +0 -382
- package/test/getUnitsSeriesOccurences.test.js +0 -133
- package/test/parseObservations.test.js +0 -116
- package/test/refineDimSeriesUnits.test.js +0 -24
- package/test/refineLayoutHierarchy.test.js +0 -79
|
@@ -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
|
-
});
|
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
import { expect } from 'chai';
|
|
2
|
-
import { getUnitsSeriesOccurences } from '../src/rules/src/table/units/getUnitsSeriesOccurences';
|
|
3
|
-
import { intersection } from 'ramda';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const attachmentSeriesIndexes = [0, 1];
|
|
7
|
-
const observations = {
|
|
8
|
-
0: {
|
|
9
|
-
dimValuesIndexes: ['0', '0', '0', '0'],
|
|
10
|
-
attrValuesIndexes: ['0', null, '0'],
|
|
11
|
-
key: '0:0:0:0',
|
|
12
|
-
units: {
|
|
13
|
-
A: { value: { index: 0 } },
|
|
14
|
-
B: { value: { index: 0 } },
|
|
15
|
-
C: { value: { index: 0 } }
|
|
16
|
-
}
|
|
17
|
-
},
|
|
18
|
-
1: {
|
|
19
|
-
dimValuesIndexes: ['0', '0', '1', '0'],
|
|
20
|
-
attrValuesIndexes: ['0', null, '1'],
|
|
21
|
-
key: '0:0:1:0',
|
|
22
|
-
units: {
|
|
23
|
-
A: { value: { index: 0 } },
|
|
24
|
-
B: { value: { index: 0 } },
|
|
25
|
-
C: { value: { index: 1 } }
|
|
26
|
-
}
|
|
27
|
-
},
|
|
28
|
-
2: {
|
|
29
|
-
dimValuesIndexes: ['1', '0', '0', '0'],
|
|
30
|
-
attrValuesIndexes: ['1', null, '0'],
|
|
31
|
-
key: '1:0:0:0',
|
|
32
|
-
units: {
|
|
33
|
-
A: { value: { index: 1 } },
|
|
34
|
-
B: { value: { index: 1 } },
|
|
35
|
-
C: { value: { index: 0 } }
|
|
36
|
-
}
|
|
37
|
-
},
|
|
38
|
-
3: {
|
|
39
|
-
dimValuesIndexes: ['1', '0', '1', '0'],
|
|
40
|
-
attrValuesIndexes: ['1', null, '0'],
|
|
41
|
-
key: '1:0:1:0',
|
|
42
|
-
units: {
|
|
43
|
-
A: { value: { index: 1 } },
|
|
44
|
-
B: { value: { index: 1 } },
|
|
45
|
-
C: { value: { index: 0 } }
|
|
46
|
-
}
|
|
47
|
-
},
|
|
48
|
-
4: {
|
|
49
|
-
dimValuesIndexes: ['2', '0', '0', '0'],
|
|
50
|
-
attrValuesIndexes: ['0', null, '0'],
|
|
51
|
-
key: '2:0:0:0',
|
|
52
|
-
units: {
|
|
53
|
-
A: { value: { index: 2 } },
|
|
54
|
-
B: { value: { index: 0 } },
|
|
55
|
-
C: { value: { index: 0 } }
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
describe('getUnitsSeriesOccurences tests', () => {
|
|
61
|
-
it('blank test', () => {
|
|
62
|
-
expect(getUnitsSeriesOccurences({
|
|
63
|
-
attachmentSeriesIndexes: []
|
|
64
|
-
})({})).to.deep.equal({ rawUnitsSeries: {}, obs: {} });
|
|
65
|
-
});
|
|
66
|
-
it('basic test', () => {
|
|
67
|
-
expect(getUnitsSeriesOccurences({ attachmentSeriesIndexes })(observations))
|
|
68
|
-
.to.deep.equal({
|
|
69
|
-
rawUnitsSeries: {
|
|
70
|
-
'0:0:x:x': { A: [0, 0], B: [0, 0], C: [0, 1], observations: 2 },
|
|
71
|
-
'1:0:x:x': { A: [1, 1], B: [1, 1], C: [0, 0], observations: 2 },
|
|
72
|
-
'2:0:x:x': { A: [2], B: [0], C: [0], observations: 1 }
|
|
73
|
-
},
|
|
74
|
-
obs: {
|
|
75
|
-
'0:0:0:0': {
|
|
76
|
-
dimValuesIndexes: ['0', '0', '0', '0'],
|
|
77
|
-
attrValuesIndexes: ['0', null, '0'],
|
|
78
|
-
key: '0:0:0:0',
|
|
79
|
-
units: {
|
|
80
|
-
A: { value: { index: 0 } },
|
|
81
|
-
B: { value: { index: 0 } },
|
|
82
|
-
C: { value: { index: 0 } },
|
|
83
|
-
serieKey: '0:0:x:x'
|
|
84
|
-
}
|
|
85
|
-
},
|
|
86
|
-
'0:0:1:0': {
|
|
87
|
-
dimValuesIndexes: ['0', '0', '1', '0'],
|
|
88
|
-
attrValuesIndexes: ['0', null, '1'],
|
|
89
|
-
key: '0:0:1:0',
|
|
90
|
-
units: {
|
|
91
|
-
A: { value: { index: 0 } },
|
|
92
|
-
B: { value: { index: 0 } },
|
|
93
|
-
C: { value: { index: 1 } },
|
|
94
|
-
serieKey: '0:0:x:x'
|
|
95
|
-
}
|
|
96
|
-
},
|
|
97
|
-
'1:0:0:0': {
|
|
98
|
-
dimValuesIndexes: ['1', '0', '0', '0'],
|
|
99
|
-
attrValuesIndexes: ['1', null, '0'],
|
|
100
|
-
key: '1:0:0:0',
|
|
101
|
-
units: {
|
|
102
|
-
A: { value: { index: 1 } },
|
|
103
|
-
B: { value: { index: 1 } },
|
|
104
|
-
C: { value: { index: 0 } },
|
|
105
|
-
serieKey: '1:0:x:x'
|
|
106
|
-
}
|
|
107
|
-
},
|
|
108
|
-
'1:0:1:0': {
|
|
109
|
-
dimValuesIndexes: ['1', '0', '1', '0'],
|
|
110
|
-
attrValuesIndexes: ['1', null, '0'],
|
|
111
|
-
key: '1:0:1:0',
|
|
112
|
-
units: {
|
|
113
|
-
A: { value: { index: 1 } },
|
|
114
|
-
B: { value: { index: 1 } },
|
|
115
|
-
C: { value: { index: 0 } },
|
|
116
|
-
serieKey: '1:0:x:x'
|
|
117
|
-
}
|
|
118
|
-
},
|
|
119
|
-
'2:0:0:0': {
|
|
120
|
-
dimValuesIndexes: ['2', '0', '0', '0'],
|
|
121
|
-
attrValuesIndexes: ['0', null, '0'],
|
|
122
|
-
key: '2:0:0:0',
|
|
123
|
-
units: {
|
|
124
|
-
A: { value: { index: 2 } },
|
|
125
|
-
B: { value: { index: 0 } },
|
|
126
|
-
C: { value: { index: 0 } },
|
|
127
|
-
serieKey: '2:0:x:x'
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
})
|
|
132
|
-
});
|
|
133
|
-
});
|
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
import { expect } from 'chai';
|
|
2
|
-
import { parseObservations } from '../src/rules/src/table/preparators/parseObservations';
|
|
3
|
-
import { getDisplay } from '../src/rules/src/table/preparators/getDisplay';
|
|
4
|
-
|
|
5
|
-
const observationsAttributes = {
|
|
6
|
-
a: { index: 0, values: [{ id: 'a0' }, { id: 'a1' }] },
|
|
7
|
-
b: { index: 1, id: 'b', name: 'B', values: [{ id: 'b0' }] },
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
const formatAttributes = {
|
|
11
|
-
f1: { index: 2 },
|
|
12
|
-
f2: { index: 3, values: [{ id: 'f2.1' }, null] },
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const dimensions = [
|
|
17
|
-
{ id: 'd0', values: [{ id: 'v0', __index: 0 }, { id: 'v1', __index: 1 }, { id: 'v2', __index: 2 }, { id: 'v3', __index: 3 }] },
|
|
18
|
-
{ id: 'd1', values: [{ id: 'v0', __index: 0 }] },
|
|
19
|
-
{ id: 'd2', values: [{ id: 'v0', __index: 0 }] },
|
|
20
|
-
{ id: 'd3', values: [{ id: 'v0', __index: 0 }, { id: 'v1', __index: 1 }] },
|
|
21
|
-
{ id: 'd4', values: [{ id: 'v0', __index: 0 }] },
|
|
22
|
-
];
|
|
23
|
-
|
|
24
|
-
const observations = {
|
|
25
|
-
'0:0:0:0:0': [22, 0, 0, 0, 0, 0],
|
|
26
|
-
'0:0:0:1:0': [17, 1, 0, 1, 1, 0],
|
|
27
|
-
'1:0:0:0:0': [55, 2, 0, null, null, 0],
|
|
28
|
-
'2:0:0:0:0': [35, 2, 0, null, null, null],
|
|
29
|
-
'3:0:0:0:0': [35, 2, 0, null, null, null],
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
const unitsArtefacts = {
|
|
33
|
-
dimensions: { series: { D0: { id: 'D0', index: 0, values: [{ id: 'V0' }, { id: 'V1' }, { id: 'V2' }, { id: 'V3' }] } } },
|
|
34
|
-
attributes: { series: { A4: { id: 'A4', index: 4, values: [{ id: 'V0' }] } } }
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
describe('parseObservations test', () => {
|
|
38
|
-
it('complete case', () => {
|
|
39
|
-
expect(parseObservations(
|
|
40
|
-
observations,
|
|
41
|
-
dimensions,
|
|
42
|
-
observationsAttributes,
|
|
43
|
-
formatAttributes,
|
|
44
|
-
unitsArtefacts,
|
|
45
|
-
getDisplay({ noDisplayIndexes: [], notDisplayedCodes: { D0: { values: { V3: 'V3' } } } })
|
|
46
|
-
)).to.deep.equal({
|
|
47
|
-
'0:0:0:0:0': {
|
|
48
|
-
key: '0:0:0:0:0',
|
|
49
|
-
value: 22,
|
|
50
|
-
units: { D0: { id: 'D0', value: { id: 'V0', index: 0 } }, A4: { id: 'A4', value: { id: 'V0', index: 0 } } },
|
|
51
|
-
attrValuesIndexes: [0, 0, 0, 0, 0],
|
|
52
|
-
dimValuesIndexes: ['0', '0', '0', '0', '0'],
|
|
53
|
-
indexedDimValIds: { d0: 'v0', d1: 'v0', d2: 'v0', d3: 'v0', d4: 'v0', },
|
|
54
|
-
attributes: {
|
|
55
|
-
a: { value: { id: 'a0' } },
|
|
56
|
-
b: { id: 'b', name: 'B', value: { id: 'b0' } }
|
|
57
|
-
},
|
|
58
|
-
f1: null,
|
|
59
|
-
f2: 'f2.1'
|
|
60
|
-
},
|
|
61
|
-
'0:0:0:1:0': {
|
|
62
|
-
key: '0:0:0:1:0',
|
|
63
|
-
value: 17,
|
|
64
|
-
units: { D0: { id: 'D0', value: { id: 'V0', index: 0 } }, A4: { id: 'A4', value: { id: 'V0', index: 0 } } },
|
|
65
|
-
attrValuesIndexes: [1, 0, 1, 1, 0],
|
|
66
|
-
dimValuesIndexes: ['0', '0', '0', '1', '0'],
|
|
67
|
-
indexedDimValIds: { d0: 'v0', d1: 'v0', d2: 'v0', d3: 'v1', d4: 'v0', },
|
|
68
|
-
attributes: {
|
|
69
|
-
a: { value: { id: 'a1' } },
|
|
70
|
-
b: { id: 'b', name: 'B', value: { id: 'b0' } }
|
|
71
|
-
},
|
|
72
|
-
f1: null,
|
|
73
|
-
f2: null
|
|
74
|
-
},
|
|
75
|
-
'1:0:0:0:0': {
|
|
76
|
-
key: '1:0:0:0:0',
|
|
77
|
-
value: 55,
|
|
78
|
-
units: { D0: { id: 'D0', value: { id: 'V1', index: 1 } }, A4: { id: 'A4', value: { id: 'V0', index: 0 } } },
|
|
79
|
-
attrValuesIndexes: [2, 0, null, null, 0],
|
|
80
|
-
dimValuesIndexes: ['1', '0', '0', '0', '0'],
|
|
81
|
-
indexedDimValIds: { d0: 'v1', d1: 'v0', d2: 'v0', d3: 'v0', d4: 'v0', },
|
|
82
|
-
attributes: {
|
|
83
|
-
b: { id: 'b', name: 'B', value: { id: 'b0' } }
|
|
84
|
-
},
|
|
85
|
-
f1: null,
|
|
86
|
-
f2: null
|
|
87
|
-
},
|
|
88
|
-
'2:0:0:0:0': {
|
|
89
|
-
key: '2:0:0:0:0',
|
|
90
|
-
value: 35,
|
|
91
|
-
units: { D0: { id: 'D0', value: { id: 'V2', index: 2 } }, A4: null },
|
|
92
|
-
attrValuesIndexes: [2, 0, null, null, null],
|
|
93
|
-
dimValuesIndexes: ['2', '0', '0', '0', '0'],
|
|
94
|
-
indexedDimValIds: { d0: 'v2', d1: 'v0', d2: 'v0', d3: 'v0', d4: 'v0', },
|
|
95
|
-
attributes: {
|
|
96
|
-
b: { id: 'b', name: 'B', value: { id: 'b0' } }
|
|
97
|
-
},
|
|
98
|
-
f1: null,
|
|
99
|
-
f2: null,
|
|
100
|
-
},
|
|
101
|
-
'3:0:0:0:0': {
|
|
102
|
-
key: '3:0:0:0:0',
|
|
103
|
-
value: 35,
|
|
104
|
-
units: { D0: null, A4: null },
|
|
105
|
-
attrValuesIndexes: [2, 0, null, null, null],
|
|
106
|
-
dimValuesIndexes: ['3', '0', '0', '0', '0'],
|
|
107
|
-
indexedDimValIds: { d0: 'v3', d1: 'v0', d2: 'v0', d3: 'v0', d4: 'v0', },
|
|
108
|
-
attributes: {
|
|
109
|
-
b: { id: 'b', name: 'B', value: { id: 'b0' } }
|
|
110
|
-
},
|
|
111
|
-
f1: null,
|
|
112
|
-
f2: null
|
|
113
|
-
}
|
|
114
|
-
});
|
|
115
|
-
});
|
|
116
|
-
});
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { expect } from 'chai';
|
|
2
|
-
import { refineDimSeriesUnits } from '../src/rules/src/table/units/refineDimSeriesUnits';
|
|
3
|
-
|
|
4
|
-
describe('refineDimSeriesUnits tests', () => {
|
|
5
|
-
it('blank test', () => {
|
|
6
|
-
expect(refineDimSeriesUnits({})({})).to.deep.equal({});
|
|
7
|
-
});
|
|
8
|
-
it('complete test', () => {
|
|
9
|
-
expect(refineDimSeriesUnits({
|
|
10
|
-
unitsArtefacts: {
|
|
11
|
-
A: { id: 'A', name: 'a', values: [{ id: 'a1' }] },
|
|
12
|
-
B: { id: 'B', name: 'b', values: [{ id: 'b1' }, { id: 'b2' }] },
|
|
13
|
-
C: { id: 'C', name: 'c', values: [{ id: 'c1' }, { id: 'c2' }] },
|
|
14
|
-
},
|
|
15
|
-
rejectedValueIds: ['b1', 'c2']
|
|
16
|
-
})({
|
|
17
|
-
s1: { observations: 3, A: [0, 0], B: [0, 1, 0], C: [0, 0, 0] },
|
|
18
|
-
s2: { observations: 2, A: [0, 0], B: [0, 0], C: [2, 2] }
|
|
19
|
-
})).to.deep.equal({
|
|
20
|
-
s1: { C: { id: 'C', name: 'c', value: { id: 'c1' } } },
|
|
21
|
-
s2: { A: { id: 'A', name: 'a', value: { id: 'a1' } } }
|
|
22
|
-
});
|
|
23
|
-
});
|
|
24
|
-
});
|