@sis-cc/dotstatsuite-components 15.0.21 → 16.0.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/index.js +1 -145
- package/lib/rules/src/table/index.js +0 -42
- package/lib/rules2/src/constants.js +3 -1
- package/lib/rules2/src/enhanceObservations.js +98 -0
- package/lib/rules2/src/getAttributesSeries.js +33 -0
- package/lib/rules2/src/getCombinationDefinitions.js +48 -0
- package/lib/rules2/src/getHeaderCombinations.js +42 -0
- package/lib/rules2/src/getHeaderSubtitle.js +41 -0
- package/lib/rules2/src/getManyValuesDimensions.js +39 -0
- package/lib/rules2/src/getOneValueDimensions.js +46 -0
- package/lib/rules2/src/hasCellMetadata.js +1 -1
- package/lib/rules2/src/index.js +186 -18
- package/lib/rules2/src/parseAttributes.js +50 -0
- package/lib/rules2/src/parseCombinations.js +54 -0
- package/lib/rules2/src/prepareData.js +74 -0
- package/lib/{rules/src/table/preparators/getAttributeValue.js → rules2/src/refineAttributes.js} +13 -11
- package/lib/rules2/src/table/getCells.js +74 -0
- package/lib/rules2/src/table/getCellsAttributesIds.js +63 -0
- package/lib/rules2/src/table/getCombinationDimensionsData.js +47 -0
- package/lib/rules2/src/table/getCuratedCells.js +28 -0
- package/lib/rules2/src/table/getFlagsAndNotes.js +28 -0
- package/lib/rules2/src/table/getIndexedCombinationsByDisplay.js +31 -0
- package/lib/rules2/src/table/getLayout.js +93 -0
- package/lib/rules2/src/table/getLayoutData.js +202 -0
- package/lib/{rules/src/table/factories → rules2/src/table}/getSortedLayoutIndexes.js +55 -40
- package/lib/rules2/src/table/getTableProps.js +64 -0
- package/lib/rules2/src/table/parseValueHierarchy.js +55 -0
- package/lib/{rules/src/table/factories → rules2/src/table}/refineLayoutSize.js +17 -8
- package/lib/rules2/src/{hasLayoutEntryMetadata.js → utils.js} +9 -6
- package/package.json +1 -1
- package/src/rules/src/index.js +1 -19
- package/src/rules/src/table/index.js +0 -4
- package/src/rules2/src/constants.js +2 -0
- package/src/rules2/src/enhanceObservations.js +88 -0
- package/src/rules2/src/getAttributesSeries.js +29 -0
- package/src/rules2/src/getCombinationDefinitions.js +29 -0
- package/src/rules2/src/getHeaderCombinations.js +39 -0
- package/src/rules2/src/getHeaderSubtitle.js +34 -0
- package/src/rules2/src/getManyValuesDimensions.js +34 -0
- package/src/rules2/src/getOneValueDimensions.js +33 -0
- package/src/rules2/src/hasCellMetadata.js +1 -1
- package/src/rules2/src/index.js +21 -6
- package/src/rules2/src/parseAttributes.js +36 -0
- package/src/rules2/src/parseCombinations.js +36 -0
- package/src/rules2/src/prepareData.js +50 -0
- package/src/rules2/src/refineAttributes.js +16 -0
- package/src/rules2/src/table/getCells.js +72 -0
- package/src/rules2/src/table/getCellsAttributesIds.js +38 -0
- package/src/rules2/src/table/getCombinationDimensionsData.js +38 -0
- package/src/rules2/src/table/getCuratedCells.js +33 -0
- package/src/rules2/src/table/getFlagsAndNotes.js +21 -0
- package/src/rules2/src/table/getIndexedCombinationsByDisplay.js +16 -0
- package/src/rules2/src/table/getLayout.js +80 -0
- package/src/rules2/src/table/getLayoutData.js +183 -0
- package/src/rules2/src/table/getSortedLayoutIndexes.js +119 -0
- package/src/rules2/src/table/getTableProps.js +36 -0
- package/src/rules2/src/table/parseValueHierarchy.js +27 -0
- package/src/{rules/src/table/factories → rules2/src/table}/refineLayoutSize.js +24 -8
- package/src/rules2/src/utils.js +12 -0
- package/test/enhanceObservations2.test.js +219 -0
- package/test/getAttributesSeries.test.js +58 -0
- package/test/getCells.test.js +6 -40
- package/test/getCombinationDimensionsData.test.js +48 -0
- package/test/getSortedLayoutIndexes.test.js +1025 -3
- package/test/parseAttributes.test.js +17 -62
- package/test/parseValueHierarchy.test.js +88 -0
- package/test/refineLayoutSize.test.js +2621 -1
- package/lib/rules/src/table/factories/getCells.js +0 -97
- package/lib/rules/src/table/factories/getConfirmedSeriesAttributesIds.js +0 -26
- package/lib/rules/src/table/factories/getCuratedCells.js +0 -45
- package/lib/rules/src/table/factories/getLayoutData.js +0 -168
- package/lib/rules/src/table/factories/getLayoutWithFlags.js +0 -133
- package/lib/rules/src/table/factories/getTableCells.js +0 -24
- package/lib/rules/src/table/factories/getTableData.js +0 -98
- package/lib/rules/src/table/preparators/getDimensionsAttributesRegisters.js +0 -43
- package/lib/rules/src/table/preparators/getManyValuesDimensions.js +0 -33
- package/lib/rules/src/table/preparators/getOneValueDimensions.js +0 -24
- package/lib/rules/src/table/preparators/getUniqValuesAttributes.js +0 -36
- package/lib/rules/src/table/preparators/parseAttributes.js +0 -84
- package/lib/rules/src/table/preparators/parseAttributesValuesFromObservations.js +0 -22
- package/lib/rules/src/table/preparators/parseDimensionsIds.js +0 -22
- package/lib/rules/src/table/preparators/prepareData.js +0 -191
- package/lib/rules/src/table/preparators/refineObservationsAttributesValues.js +0 -31
- package/lib/rules/src/table/preparators/refineSeriesAttributesValues.js +0 -23
- package/lib/rules/src/table/units/appendUnitsInLayoutData.js +0 -82
- package/lib/rules/src/table/units/appendUnitsInLayoutDataEntry.js +0 -45
- package/lib/rules/src/table/units/cleanUnitsInLayoutData.js +0 -66
- package/lib/rules/src/table/units/getAttachmentSeriesIndexes.js +0 -25
- package/lib/rules/src/table/units/getHeaderUnits.js +0 -35
- package/lib/rules/src/table/units/getUnitsArtefacts.js +0 -85
- package/lib/rules/src/table/units/getUnitsCodes.js +0 -23
- package/lib/rules/src/table/units/getUnitsDefinition.js +0 -33
- package/lib/rules/src/table/units/getUnitsDisplay.js +0 -33
- package/lib/rules/src/table/units/getUnitsSerieIndexes.js +0 -23
- package/lib/rules/src/table/units/getUnitsSeries.js +0 -49
- package/lib/rules/src/table/units/getUnitsinLayout.js +0 -74
- package/lib/rules/src/table/units/refineDimSeriesUnits.js +0 -44
- package/lib/rules2/src/getAdvancedAttributes.js +0 -124
- package/lib/rules2/src/invertTime.js +0 -33
- package/src/rules/src/table/factories/getCells.js +0 -102
- package/src/rules/src/table/factories/getConfirmedSeriesAttributesIds.js +0 -27
- package/src/rules/src/table/factories/getCuratedCells.js +0 -40
- package/src/rules/src/table/factories/getLayoutData.js +0 -171
- package/src/rules/src/table/factories/getLayoutWithFlags.js +0 -137
- package/src/rules/src/table/factories/getSortedLayoutIndexes.js +0 -108
- package/src/rules/src/table/factories/getTableCells.js +0 -16
- package/src/rules/src/table/factories/getTableData.js +0 -86
- package/src/rules/src/table/preparators/getAttributeValue.js +0 -17
- package/src/rules/src/table/preparators/getDimensionsAttributesRegisters.js +0 -51
- package/src/rules/src/table/preparators/getManyValuesDimensions.js +0 -19
- package/src/rules/src/table/preparators/getOneValueDimensions.js +0 -17
- package/src/rules/src/table/preparators/getUniqValuesAttributes.js +0 -24
- package/src/rules/src/table/preparators/parseAttributes.js +0 -113
- package/src/rules/src/table/preparators/parseAttributesValuesFromObservations.js +0 -16
- package/src/rules/src/table/preparators/parseDimensionsIds.js +0 -17
- package/src/rules/src/table/preparators/prepareData.js +0 -197
- package/src/rules/src/table/preparators/refineObservationsAttributesValues.js +0 -22
- package/src/rules/src/table/preparators/refineSeriesAttributesValues.js +0 -11
- package/src/rules/src/table/units/appendUnitsInLayoutData.js +0 -56
- package/src/rules/src/table/units/appendUnitsInLayoutDataEntry.js +0 -38
- package/src/rules/src/table/units/cleanUnitsInLayoutData.js +0 -65
- package/src/rules/src/table/units/getAttachmentSeriesIndexes.js +0 -27
- package/src/rules/src/table/units/getHeaderUnits.js +0 -32
- package/src/rules/src/table/units/getUnitsArtefacts.js +0 -90
- package/src/rules/src/table/units/getUnitsCodes.js +0 -22
- package/src/rules/src/table/units/getUnitsDefinition.js +0 -34
- package/src/rules/src/table/units/getUnitsDisplay.js +0 -19
- package/src/rules/src/table/units/getUnitsSerieIndexes.js +0 -12
- package/src/rules/src/table/units/getUnitsSeries.js +0 -41
- package/src/rules/src/table/units/getUnitsinLayout.js +0 -71
- package/src/rules/src/table/units/refineDimSeriesUnits.js +0 -26
- package/src/rules2/src/getAdvancedAttributes.js +0 -111
- package/src/rules2/src/hasLayoutEntryMetadata.js +0 -9
- package/src/rules2/src/invertTime.js +0 -22
- package/test/advanced-attributes-parsing-perf.test.js +0 -16
- package/test/appendUnitsInLayoutDataEntry.test.js +0 -65
- package/test/cleanUnitsInLayoutData.test.js +0 -85
- package/test/enhanceObservations.test.js +0 -340
- package/test/getAttachmentSeriesIndexes.test.js +0 -35
- package/test/getConfirmedSeriesAttributesIds.test.js +0 -27
- package/test/getDataflowAdvancedAttributes.test.js +0 -32
- package/test/getHeaderUnits.test.js +0 -51
- package/test/getLayoutData.test.js +0 -206
- package/test/getLayoutDataWithFlags.test.js +0 -142
- package/test/getOneValueDimensions.test.js +0 -26
- package/test/getSeriesAdvancedAttributes.test.js +0 -32
- package/test/getSubtitleFlags.test.js +0 -42
- package/test/getTableData.test.js +0 -1317
- package/test/getUnitsArtefacts.test.js +0 -117
- package/test/getUnitsDefinition.test.js +0 -37
- package/test/getUnitsInLayout.test.js +0 -77
- package/test/getUnitsSeries.test.js +0 -154
- package/test/invertTime.test.js +0 -77
- package/test/parseAttributesValuesFromObservations.test.js +0 -45
- package/test/parseDimensionsIds.test.js +0 -20
- package/test/prepareData.test.js +0 -29
- package/test/refineObservationsAttributesValues.test.js +0 -33
- package/test/table-invert-time-perf.test.js +0 -11
- package/test/table-layout-perf.test.js +0 -74
- package/test/table-prep-duplicate-perf.test.js +0 -15
- package/test/table-prep-perf.test.js +0 -61
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
import { expect } from 'chai';
|
|
2
|
-
import { getUnitsArtefacts } from '../src/rules/src/table/units/getUnitsArtefacts';
|
|
3
|
-
|
|
4
|
-
const data = {
|
|
5
|
-
structure: {
|
|
6
|
-
attributes: {
|
|
7
|
-
observation: [
|
|
8
|
-
{ id: 'A3', values: [] },
|
|
9
|
-
{ id: 'A4', relationship: { dimensions: ['D2'] }, values: [{ id: 'V1' }] },
|
|
10
|
-
{ id: 'A5', relationship: { dimensions: ['D2'] }, values: [{ id: 'V1' }, { id: 'V2' }] },
|
|
11
|
-
{ id: 'A6', relationship: { dimensions: ['D1'] }, values: [{ id: 'V1' }] },
|
|
12
|
-
{ id: 'A7', relationship: { dimensions: ['D1', 'D2'] }, values: [{ id: 'V1' }] },
|
|
13
|
-
{ id: 'A8', relationship: { primaryMeasure: 'OBS_VALUE' }, values: [{ id: 'V1' }, { id: 'V2' }] },
|
|
14
|
-
{ id: 'A9', relationship: { primaryMeasure: 'OBS_VALUE' }, values: [{ id: 'V1' }, { id: 'V2' }], display: false },
|
|
15
|
-
{ id: 'A10', relationship: { observation: {} }, values: [{ id: 'V1' }, { id: 'V2' }] },
|
|
16
|
-
{ id: 'A0', relationship: { none: {} }, values: [] },
|
|
17
|
-
{ id: 'A1', relationship: { none: {} }, values: [{ id: 'V1' }] },
|
|
18
|
-
{ id: 'A2', relationship: { dataflow: {} }, values: [{ id: 'V1' }, { id: 'V2' }] },
|
|
19
|
-
]
|
|
20
|
-
},
|
|
21
|
-
dimensions: {
|
|
22
|
-
observation: [
|
|
23
|
-
{ id: 'D0', values: [] },
|
|
24
|
-
{ id: 'D1', values: [{ id: 'V1' }] },
|
|
25
|
-
{ id: 'D2', values: [{ id: 'V1' }, { id: 'V2' }] },
|
|
26
|
-
]
|
|
27
|
-
},
|
|
28
|
-
}
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
describe('getUnitsArtefacts tests', () => {
|
|
32
|
-
it('no data', () => {
|
|
33
|
-
expect(getUnitsArtefacts({ data: { data: undefined } })).to.deep.equal({
|
|
34
|
-
attributes: { header: {}, series: {} },
|
|
35
|
-
dimensions: { header: {}, series: {} },
|
|
36
|
-
});
|
|
37
|
-
});
|
|
38
|
-
it('no units definition codes', () => {
|
|
39
|
-
expect(getUnitsArtefacts({ data: { data } })).to.deep.equal({
|
|
40
|
-
attributes: { header: {}, series: {} },
|
|
41
|
-
dimensions: { header: {}, series: {} },
|
|
42
|
-
});
|
|
43
|
-
});
|
|
44
|
-
it('full header', () => {
|
|
45
|
-
expect(getUnitsArtefacts({ data: { data }, unitsDefinitionCodes: ['A1', 'D1'] })).to.deep.equal({
|
|
46
|
-
attributes: { header: { A1: { id: 'A1', relationship: { none: {} }, index: 9, datasetLevel: true, values: [{ id: 'V1' }] } }, series: {} },
|
|
47
|
-
dimensions: { header: { D1: { id: 'D1', header: true, index: 1, values: [{ id: 'V1' }] } }, series: {} },
|
|
48
|
-
});
|
|
49
|
-
});
|
|
50
|
-
it('full series', () => {
|
|
51
|
-
expect(getUnitsArtefacts({ data: { data }, unitsDefinitionCodes: ['A4', 'A5', 'D2'] })).to.deep.equal({
|
|
52
|
-
attributes: {
|
|
53
|
-
series: {
|
|
54
|
-
A4: { id: 'A4', index: 1, relationship: { dimensions: ['D2'] }, values: [{ id: 'V1' }] },
|
|
55
|
-
A5: { id: 'A5', index: 2, relationship: { dimensions: ['D2'] }, values: [{ id: 'V1' }, { id: 'V2' }] }
|
|
56
|
-
},
|
|
57
|
-
header: {}
|
|
58
|
-
},
|
|
59
|
-
dimensions: { series: { D2: { id: 'D2', index: 2, values: [{ id: 'V1' }, { id: 'V2' }] } }, header: {} },
|
|
60
|
-
});
|
|
61
|
-
});
|
|
62
|
-
it('header dimensions with series', () => {
|
|
63
|
-
expect(getUnitsArtefacts({ data: { data }, unitsDefinitionCodes: ['A4', 'A5', 'D1', 'D2'] })).to.deep.equal({
|
|
64
|
-
attributes: {
|
|
65
|
-
series: {
|
|
66
|
-
A4: { id: 'A4', index: 1, relationship: { dimensions: ['D2'] }, values: [{ id: 'V1' }] },
|
|
67
|
-
A5: { id: 'A5', index: 2, relationship: { dimensions: ['D2'] }, values: [{ id: 'V1' }, { id: 'V2' }] }
|
|
68
|
-
},
|
|
69
|
-
header: {}
|
|
70
|
-
},
|
|
71
|
-
dimensions: {
|
|
72
|
-
series: {
|
|
73
|
-
D1: { id: 'D1', index: 1, header: true, values: [{ id: 'V1' }] },
|
|
74
|
-
D2: { id: 'D2', index: 2, values: [{ id: 'V1' }, { id: 'V2' }] }
|
|
75
|
-
},
|
|
76
|
-
header: {},
|
|
77
|
-
}
|
|
78
|
-
});
|
|
79
|
-
});
|
|
80
|
-
it('header attributes with series', () => {
|
|
81
|
-
expect(getUnitsArtefacts({ data: { data }, unitsDefinitionCodes: ['A1', 'A4', 'A5', 'D2'] })).to.deep.equal({
|
|
82
|
-
attributes: {
|
|
83
|
-
series: {
|
|
84
|
-
A1: { id: 'A1', relationship: { none: {} }, index: 9, datasetLevel: true, values: [{ id: 'V1' }] },
|
|
85
|
-
A4: { id: 'A4', index: 1, relationship: { dimensions: ['D2'] }, values: [{ id: 'V1' }] },
|
|
86
|
-
A5: { id: 'A5', index: 2, relationship: { dimensions: ['D2'] }, values: [{ id: 'V1' }, { id: 'V2' }] }
|
|
87
|
-
},
|
|
88
|
-
header: {}
|
|
89
|
-
},
|
|
90
|
-
dimensions: { series: { D2: { id: 'D2', index: 2, values: [{ id: 'V1' }, { id: 'V2' }] } }, header: {} },
|
|
91
|
-
});
|
|
92
|
-
});
|
|
93
|
-
it('all attached dimensions single value makes a header', () => {
|
|
94
|
-
expect(getUnitsArtefacts({ data: { data }, unitsDefinitionCodes: ['A6'] })).to.deep.equal({
|
|
95
|
-
attributes: { header: { A6: { id: 'A6', index: 3, relationship: { dimensions: [] }, values: [{ id: 'V1' }] }, }, series: {} },
|
|
96
|
-
dimensions: { header: {}, series: {} },
|
|
97
|
-
});
|
|
98
|
-
});
|
|
99
|
-
it('series attributes keeps only multi values dimensions in attachment', () => {
|
|
100
|
-
expect(getUnitsArtefacts({ data: { data }, unitsDefinitionCodes: ['A7'] })).to.deep.equal({
|
|
101
|
-
attributes: { series: { A7: { id: 'A7', index: 4, relationship: { dimensions: ['D2'] }, values: [{ id: 'V1' }] }, }, header: {} },
|
|
102
|
-
dimensions: { header: {}, series: {} },
|
|
103
|
-
});
|
|
104
|
-
});
|
|
105
|
-
it('no display annotations', () => {
|
|
106
|
-
expect(getUnitsArtefacts({ data: { data }, unitsDefinitionCodes: ['A8', 'A9'] })).to.deep.equal({
|
|
107
|
-
attributes: { header: {}, series: { A8: { id: 'A8', observations: true, index: 5, relationship: { primaryMeasure: 'OBS_VALUE' }, values: [{ id: 'V1' }, { id: 'V2' }] } } },
|
|
108
|
-
dimensions: { header: {}, series: {} },
|
|
109
|
-
});
|
|
110
|
-
});
|
|
111
|
-
it('observation relationship', () => {
|
|
112
|
-
expect(getUnitsArtefacts({ data: { data }, unitsDefinitionCodes: ['A9', 'A10'] })).to.deep.equal({
|
|
113
|
-
attributes: { header: {}, series: { A10: { id: 'A10', observations: true, index: 7, relationship: { observation: {} }, values: [{ id: 'V1' }, { id: 'V2' }] } } },
|
|
114
|
-
dimensions: { header: {}, series: {} },
|
|
115
|
-
});
|
|
116
|
-
});
|
|
117
|
-
});
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { expect } from 'chai';
|
|
2
|
-
import { getUnitsDefinition } from '../src/rules/src/table/units/getUnitsDefinition';
|
|
3
|
-
|
|
4
|
-
const data = {
|
|
5
|
-
data: {
|
|
6
|
-
dataSets: [{
|
|
7
|
-
annotations: [0, 3]
|
|
8
|
-
}],
|
|
9
|
-
structure: {
|
|
10
|
-
annotations: [
|
|
11
|
-
{ type: 'A0' },
|
|
12
|
-
{ trash: true },
|
|
13
|
-
{ type: 'A1', title: 'C0,C1,C2' },
|
|
14
|
-
{ type: 'A2', title: 'C3,C4' },
|
|
15
|
-
]
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
describe('getUnitsDefinition tests', () => {
|
|
21
|
-
it('no annotation id provided', () => {
|
|
22
|
-
expect(getUnitsDefinition({ data, defaultCodes: ['C5', 'C6'], annotationsDefinitionCodes: {} }))
|
|
23
|
-
.to.deep.equal(['C5', 'C6']);
|
|
24
|
-
});
|
|
25
|
-
it('no codes in annotation', () => {
|
|
26
|
-
expect(getUnitsDefinition({ data, defaultCodes: ['C5', 'C6'], annotationsDefinitionCodes: { concepts: ['A0'] } }))
|
|
27
|
-
.to.deep.equal(['C5', 'C6']);
|
|
28
|
-
});
|
|
29
|
-
it('not a dataset annotation', () => {
|
|
30
|
-
expect(getUnitsDefinition({ data, defaultCodes: ['C5', 'C6'], annotationsDefinitionCodes: { concepts: ['A1'] } }))
|
|
31
|
-
.to.deep.equal(['C5', 'C6']);
|
|
32
|
-
});
|
|
33
|
-
it('basic case', () => {
|
|
34
|
-
expect(getUnitsDefinition({ data, defaultCodes: ['C5', 'C6'], annotationsDefinitionCodes: { concepts: ['A2'] } }))
|
|
35
|
-
.to.deep.equal(['C3', 'C4']);
|
|
36
|
-
});
|
|
37
|
-
});
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import { expect } from 'chai';
|
|
2
|
-
import { getUnitsInLayout } from '../src/rules/src/table/units/getUnitsinLayout';
|
|
3
|
-
|
|
4
|
-
describe('getUnitsInLayout tests', () => {
|
|
5
|
-
it('blank test', () => {
|
|
6
|
-
expect(getUnitsInLayout({
|
|
7
|
-
layoutIds: { header: [], sections: [], rows: [] },
|
|
8
|
-
unitsAttachmentSeriesIds: [],
|
|
9
|
-
unitsDefinitionCodes: [],
|
|
10
|
-
unitsSeries: {}
|
|
11
|
-
})).to.deep.equal({
|
|
12
|
-
unitsLevelDisplay: 'cells',
|
|
13
|
-
unitsAttachmentIndexesInLayout: { header: [], sections: [], rows: [] },
|
|
14
|
-
unitsIndexesInLayout: { header: [], sections: [], rows: [] },
|
|
15
|
-
});
|
|
16
|
-
});
|
|
17
|
-
it('header case', () => {
|
|
18
|
-
expect(getUnitsInLayout({
|
|
19
|
-
layoutIds: { header: ['H1', 'H2', 'H3'], sections: ['S1', 'S2', 'S3'], rows: ['R1', 'R2', 'R3'] },
|
|
20
|
-
unitsAttachmentSeriesIds: ['H1', 'H3'],
|
|
21
|
-
unitsDefinitionCodes: ['H1'],
|
|
22
|
-
unitsSeries: { not: 'empty' }
|
|
23
|
-
})).to.deep.equal({
|
|
24
|
-
unitsLevelDisplay: 'header',
|
|
25
|
-
unitsAttachmentIndexesInLayout: { header: [0, 2], sections: [], rows: [] },
|
|
26
|
-
unitsIndexesInLayout: { header: [0], sections: [], rows: [] },
|
|
27
|
-
});
|
|
28
|
-
});
|
|
29
|
-
it('sections case', () => {
|
|
30
|
-
expect(getUnitsInLayout({
|
|
31
|
-
layoutIds: { header: ['H1', 'H2', 'H3'], sections: ['S1', 'S2', 'S3'], rows: ['R1', 'R2', 'R3'] },
|
|
32
|
-
unitsAttachmentSeriesIds: ['S2', 'S3'],
|
|
33
|
-
unitsDefinitionCodes: ['S2', 'S3'],
|
|
34
|
-
unitsSeries: { not: 'empty' }
|
|
35
|
-
})).to.deep.equal({
|
|
36
|
-
unitsLevelDisplay: 'sections',
|
|
37
|
-
unitsAttachmentIndexesInLayout: { header: [], sections: [1, 2], rows: [] },
|
|
38
|
-
unitsIndexesInLayout: { header: [], sections: [1, 2], rows: [] },
|
|
39
|
-
});
|
|
40
|
-
});
|
|
41
|
-
it('only rows case', () => {
|
|
42
|
-
expect(getUnitsInLayout({
|
|
43
|
-
layoutIds: { header: ['H1', 'H2', 'H3'], sections: ['S1', 'S2', 'S3'], rows: ['R1', 'R2', 'R3'] },
|
|
44
|
-
unitsAttachmentSeriesIds: ['R2'],
|
|
45
|
-
unitsDefinitionCodes: [],
|
|
46
|
-
unitsSeries: { not: 'empty' }
|
|
47
|
-
})).to.deep.equal({
|
|
48
|
-
unitsLevelDisplay: 'rows',
|
|
49
|
-
unitsAttachmentIndexesInLayout: { header: [], sections: [], rows: [1] },
|
|
50
|
-
unitsIndexesInLayout: { header: [], sections: [], rows: [] },
|
|
51
|
-
});
|
|
52
|
-
});
|
|
53
|
-
it('rows and sections case', () => {
|
|
54
|
-
expect(getUnitsInLayout({
|
|
55
|
-
layoutIds: { header: ['H1', 'H2', 'H3'], sections: ['S1', 'S2', 'S3'], rows: ['R1', 'R2', 'R3'] },
|
|
56
|
-
unitsAttachmentSeriesIds: ['R2', 'S1', 'S3'],
|
|
57
|
-
unitsDefinitionCodes: ['R2', 'S1'],
|
|
58
|
-
unitsSeries: { not: 'empty' }
|
|
59
|
-
})).to.deep.equal({
|
|
60
|
-
unitsLevelDisplay: 'rows',
|
|
61
|
-
unitsAttachmentIndexesInLayout: { header: [], sections: [0, 2], rows: [1] },
|
|
62
|
-
unitsIndexesInLayout: { header: [], sections: [0], rows: [1] },
|
|
63
|
-
});
|
|
64
|
-
});
|
|
65
|
-
it('mixed case', () => {
|
|
66
|
-
expect(getUnitsInLayout({
|
|
67
|
-
layoutIds: { header: ['H1', 'H2', 'H3'], sections: ['S1', 'S2', 'S3'], rows: ['R1', 'R2', 'R3'] },
|
|
68
|
-
unitsAttachmentSeriesIds: ['R2', 'S1', 'H3'],
|
|
69
|
-
unitsDefinitionCodes: [],
|
|
70
|
-
unitsSeries: { not: 'empty' }
|
|
71
|
-
})).to.deep.equal({
|
|
72
|
-
unitsLevelDisplay: 'cells',
|
|
73
|
-
unitsAttachmentIndexesInLayout: { header: [], sections: [], rows: [] },
|
|
74
|
-
unitsIndexesInLayout: { header: [], sections: [], rows: [] },
|
|
75
|
-
});
|
|
76
|
-
});
|
|
77
|
-
});
|
|
@@ -1,154 +0,0 @@
|
|
|
1
|
-
import { expect } from 'chai';
|
|
2
|
-
import { getUnitsSeries } from '../src/rules/src/table/units/getUnitsSeries';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
describe('getUnitsSeries tests', () => {
|
|
6
|
-
const observations = {
|
|
7
|
-
0: {
|
|
8
|
-
key: '0:0:0:0',
|
|
9
|
-
units: {
|
|
10
|
-
serieKey: '0:0:x:x',
|
|
11
|
-
A: { value: { index: 0 } },
|
|
12
|
-
B: { value: { index: 0 } },
|
|
13
|
-
C: { value: { index: 0 } }
|
|
14
|
-
}
|
|
15
|
-
},
|
|
16
|
-
1: {
|
|
17
|
-
key: '0:0:1:0',
|
|
18
|
-
units: {
|
|
19
|
-
serieKey: '0:0:x:x',
|
|
20
|
-
A: { value: { index: 0 } },
|
|
21
|
-
B: { value: { index: 0 } },
|
|
22
|
-
C: { value: { index: 1 } }
|
|
23
|
-
}
|
|
24
|
-
},
|
|
25
|
-
2: {
|
|
26
|
-
key: '1:0:0:0',
|
|
27
|
-
units: {
|
|
28
|
-
serieKey: '1:0:x:x',
|
|
29
|
-
A: { value: { index: 1 } },
|
|
30
|
-
B: { value: { index: 1 } },
|
|
31
|
-
C: { value: { index: 0 } }
|
|
32
|
-
}
|
|
33
|
-
},
|
|
34
|
-
3: {
|
|
35
|
-
key: '1:0:1:0',
|
|
36
|
-
units: {
|
|
37
|
-
serieKey: '1:0:x:x',
|
|
38
|
-
A: { value: { index: 1 } },
|
|
39
|
-
B: { value: { index: 1 } },
|
|
40
|
-
C: { value: { index: 0 } }
|
|
41
|
-
}
|
|
42
|
-
},
|
|
43
|
-
4: {
|
|
44
|
-
key: '2:0:0:0',
|
|
45
|
-
units: {
|
|
46
|
-
serieKey: '2:0:x:x',
|
|
47
|
-
A: { value: { index: 2 } },
|
|
48
|
-
B: { value: { index: 0 } },
|
|
49
|
-
C: { value: { index: 0 } }
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
it('blank test', () => {
|
|
54
|
-
expect(getUnitsSeries({})).to.deep.equal({});
|
|
55
|
-
});
|
|
56
|
-
it('basic test', () => {
|
|
57
|
-
expect(getUnitsSeries(observations))
|
|
58
|
-
.to.deep.equal({
|
|
59
|
-
'0:0:x:x': { A: { value: { index: 0 } }, B: { value: { index: 0 } }, C: null, serieKey: '0:0:x:x' },
|
|
60
|
-
'1:0:x:x': { A: { value: { index: 1 } }, B: { value: { index: 1 } }, C: { value: { index: 0 } }, serieKey: '1:0:x:x' },
|
|
61
|
-
'2:0:x:x': { A: { value: { index: 2 } }, B: { value: { index: 0 } }, C: { value: { index: 0 } }, serieKey: '2:0:x:x' }
|
|
62
|
-
});
|
|
63
|
-
});
|
|
64
|
-
it('empty units test', () => {
|
|
65
|
-
const obs = {
|
|
66
|
-
0: {
|
|
67
|
-
key: '0:0:0:0',
|
|
68
|
-
units: { serieKey: '0:0:x:x' }
|
|
69
|
-
},
|
|
70
|
-
1: {
|
|
71
|
-
key: '0:0:1:0',
|
|
72
|
-
units: { serieKey: '0:0:x:x' }
|
|
73
|
-
},
|
|
74
|
-
2: {
|
|
75
|
-
key: '1:0:0:0',
|
|
76
|
-
units: { serieKey: '1:0:x:x' }
|
|
77
|
-
},
|
|
78
|
-
3: {
|
|
79
|
-
key: '1:0:1:0',
|
|
80
|
-
units: { serieKey: '1:0:x:x' }
|
|
81
|
-
},
|
|
82
|
-
4: {
|
|
83
|
-
key: '2:0:0:0',
|
|
84
|
-
units: { serieKey: '2:0:x:x' }
|
|
85
|
-
}
|
|
86
|
-
};
|
|
87
|
-
expect(getUnitsSeries(obs)).to.deep.equal({});
|
|
88
|
-
});
|
|
89
|
-
});
|
|
90
|
-
|
|
91
|
-
describe('getUnitsSeries tests keys difference', () => {
|
|
92
|
-
const observations = {
|
|
93
|
-
"0:0:0:0:0:0": {
|
|
94
|
-
"key": "0:0:0:0:0:0",
|
|
95
|
-
"units": {
|
|
96
|
-
"UNIT_MEASURE": { "value": { "index": 0 }},
|
|
97
|
-
"UNIT_MULT": { "value": { "index": 0 }},
|
|
98
|
-
"serieKey": "x:x:x:x:0:x"
|
|
99
|
-
},
|
|
100
|
-
},
|
|
101
|
-
"0:0:0:0:0:1": {
|
|
102
|
-
"key": "0:0:0:0:0:1",
|
|
103
|
-
"units": {
|
|
104
|
-
"UNIT_MEASURE": { "value": { "index": 0 }},
|
|
105
|
-
"UNIT_MULT": { "value": { "index": 0 }},
|
|
106
|
-
"serieKey": "x:x:x:x:0:x"
|
|
107
|
-
},
|
|
108
|
-
},
|
|
109
|
-
"0:0:0:1:0:0": {
|
|
110
|
-
"key": "0:0:0:1:0:0",
|
|
111
|
-
"units": {
|
|
112
|
-
"UNIT_MEASURE": { "value": { "index": 0 }},
|
|
113
|
-
"serieKey": "x:x:x:x:0:x"
|
|
114
|
-
},
|
|
115
|
-
},
|
|
116
|
-
"0:0:0:1:0:1": {
|
|
117
|
-
"key": "0:0:0:1:0:1",
|
|
118
|
-
"units": {
|
|
119
|
-
"UNIT_MEASURE": { "value": { "index": 0 }},
|
|
120
|
-
"serieKey": "x:x:x:x:0:x"
|
|
121
|
-
},
|
|
122
|
-
},
|
|
123
|
-
"0:0:0:2:1:0": {
|
|
124
|
-
"key": "0:0:0:2:1:0",
|
|
125
|
-
"units": {
|
|
126
|
-
"UNIT_MEASURE": { "value": { "index": 1 }},
|
|
127
|
-
"UNIT_MULT": { "value": { "index": 0 }},
|
|
128
|
-
"serieKey": "x:x:x:x:1:x"
|
|
129
|
-
},
|
|
130
|
-
},
|
|
131
|
-
"0:0:0:2:1:1": {
|
|
132
|
-
"key": "0:0:0:2:1:1",
|
|
133
|
-
"units": {
|
|
134
|
-
"UNIT_MEASURE": { "value": { "index": 1 }},
|
|
135
|
-
"UNIT_MULT": { "value": { "index": 0 }},
|
|
136
|
-
"serieKey": "x:x:x:x:1:x"
|
|
137
|
-
},
|
|
138
|
-
}
|
|
139
|
-
};
|
|
140
|
-
const expected = {
|
|
141
|
-
"x:x:x:x:0:x": {
|
|
142
|
-
"UNIT_MEASURE": { "value": { "index": 0 }},
|
|
143
|
-
"serieKey": "x:x:x:x:0:x"
|
|
144
|
-
},
|
|
145
|
-
"x:x:x:x:1:x": {
|
|
146
|
-
"UNIT_MEASURE": { "value": { "index": 1 }},
|
|
147
|
-
"UNIT_MULT": { "value": { "index": 0 }},
|
|
148
|
-
"serieKey": "x:x:x:x:1:x"
|
|
149
|
-
}
|
|
150
|
-
};
|
|
151
|
-
it('basic test', () => {
|
|
152
|
-
expect(getUnitsSeries(observations)).to.deep.equal(expected);
|
|
153
|
-
});
|
|
154
|
-
});
|
package/test/invertTime.test.js
DELETED
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import { expect } from 'chai';
|
|
2
|
-
import { invertTime } from '../src/rules2/src/invertTime';
|
|
3
|
-
|
|
4
|
-
describe('invertTime tests', () => {
|
|
5
|
-
it('complete test', () => {
|
|
6
|
-
const dimensions = {
|
|
7
|
-
many: {
|
|
8
|
-
TIME_PERIOD: {
|
|
9
|
-
id: 'TIME_PERIOD',
|
|
10
|
-
__index: 1,
|
|
11
|
-
role: 'TIME_PERIOD',
|
|
12
|
-
values: [
|
|
13
|
-
{ id: 2000 },
|
|
14
|
-
{ id: 2001 },
|
|
15
|
-
{ id: 2002 },
|
|
16
|
-
{ id: 2003 },
|
|
17
|
-
{ id: 2004 },
|
|
18
|
-
{ id: 2005 },
|
|
19
|
-
{ id: 2006 },
|
|
20
|
-
{ id: 2007 },
|
|
21
|
-
{ id: 2008 },
|
|
22
|
-
{ id: 2009 },
|
|
23
|
-
]
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
const observations = {
|
|
29
|
-
'0:0': { orderedDimIndexes: [0, 0] },
|
|
30
|
-
'0:1': { orderedDimIndexes: [0, 1] },
|
|
31
|
-
'0:2': { orderedDimIndexes: [0, 2] },
|
|
32
|
-
'0:3': { orderedDimIndexes: [0, 3] },
|
|
33
|
-
'0:4': { orderedDimIndexes: [0, 4] },
|
|
34
|
-
'0:5': { orderedDimIndexes: [0, 5] },
|
|
35
|
-
'0:6': { orderedDimIndexes: [0, 6] },
|
|
36
|
-
'0:7': { orderedDimIndexes: [0, 7] },
|
|
37
|
-
'0:8': { orderedDimIndexes: [0, 8] },
|
|
38
|
-
'0:9': { orderedDimIndexes: [0, 9] },
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
const expected = {
|
|
42
|
-
dimensions: {
|
|
43
|
-
TIME_PERIOD: {
|
|
44
|
-
id: 'TIME_PERIOD',
|
|
45
|
-
role: 'TIME_PERIOD',
|
|
46
|
-
__index: 1,
|
|
47
|
-
values: [
|
|
48
|
-
{ id: 2009 },
|
|
49
|
-
{ id: 2008 },
|
|
50
|
-
{ id: 2007 },
|
|
51
|
-
{ id: 2006 },
|
|
52
|
-
{ id: 2005 },
|
|
53
|
-
{ id: 2004 },
|
|
54
|
-
{ id: 2003 },
|
|
55
|
-
{ id: 2002 },
|
|
56
|
-
{ id: 2001 },
|
|
57
|
-
{ id: 2000 },
|
|
58
|
-
]
|
|
59
|
-
}
|
|
60
|
-
},
|
|
61
|
-
observations: {
|
|
62
|
-
'0:0': { orderedDimIndexes: [0, 9] },
|
|
63
|
-
'0:1': { orderedDimIndexes: [0, 8] },
|
|
64
|
-
'0:2': { orderedDimIndexes: [0, 7] },
|
|
65
|
-
'0:3': { orderedDimIndexes: [0, 6] },
|
|
66
|
-
'0:4': { orderedDimIndexes: [0, 5] },
|
|
67
|
-
'0:5': { orderedDimIndexes: [0, 4] },
|
|
68
|
-
'0:6': { orderedDimIndexes: [0, 3] },
|
|
69
|
-
'0:7': { orderedDimIndexes: [0, 2] },
|
|
70
|
-
'0:8': { orderedDimIndexes: [0, 1] },
|
|
71
|
-
'0:9': { orderedDimIndexes: [0, 0] },
|
|
72
|
-
}
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
expect(invertTime({ dimensions, observations }, true)).to.deep.equal(expected);
|
|
76
|
-
});
|
|
77
|
-
});
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { expect } from 'chai';
|
|
2
|
-
import { parseAttributesValuesFromObservations } from '../src/rules/src/table/preparators/parseAttributesValuesFromObservations';
|
|
3
|
-
import { getDimensionsAttributesRegisters } from '../src/rules/src/table/preparators/getDimensionsAttributesRegisters';
|
|
4
|
-
|
|
5
|
-
const attributesIdsIndexedByTargets = {
|
|
6
|
-
manyValuesDimensions: ['a1', 'a3'],
|
|
7
|
-
series: ['a2', 'a4']
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
const attributesIndexedByIds = {
|
|
11
|
-
a1: { id: 'a1', index: 0, targetIndex: 3 },
|
|
12
|
-
a2: { id: 'a2', index: 1, targetIndexes: { '0': 0, '1': 1 } },
|
|
13
|
-
a3: { id: 'a3', index: 2, targetIndex: 2 },
|
|
14
|
-
a4: { id: 'a4', index: 3, targetIndexes: { '1': 1, '4': 4 } }
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
const observations = {
|
|
18
|
-
a: { dimValuesIndexes: [0, 0, 0, 0, 0], attrValuesIndexes: [0, 3, 0, 0] },
|
|
19
|
-
b: { dimValuesIndexes: [0, 0, 0, 0, 1], attrValuesIndexes: [0, 3, 1, 2] },
|
|
20
|
-
c: { dimValuesIndexes: [0, 0, 1, 0, 0], attrValuesIndexes: [0, 3, 5, null] },
|
|
21
|
-
d: { dimValuesIndexes: [0, 0, 1, 0, 1], attrValuesIndexes: [0, 3, 0, 2] },
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
const attributesRegisters = getDimensionsAttributesRegisters(
|
|
25
|
-
attributesIdsIndexedByTargets,
|
|
26
|
-
attributesIndexedByIds
|
|
27
|
-
);
|
|
28
|
-
|
|
29
|
-
describe('parseAttributesValuesFromObservations test', () => {
|
|
30
|
-
it('test', () => {
|
|
31
|
-
expect(parseAttributesValuesFromObservations(observations, attributesRegisters))
|
|
32
|
-
.to.deep.equal({
|
|
33
|
-
series: {
|
|
34
|
-
'0:0:x:x:x': { a2: [3, 3, 3, 3] },
|
|
35
|
-
'x:0:x:x:0': { a4: [0, null] },
|
|
36
|
-
'x:0:x:x:1': { a4: [2, 2] }
|
|
37
|
-
},
|
|
38
|
-
dimensions: {
|
|
39
|
-
'3:0': { a1: [0, 0, 0, 0] },
|
|
40
|
-
'2:0': { a3: [0, 1] },
|
|
41
|
-
'2:1': { a3: [5, 0] }
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
});
|
|
45
|
-
});
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { expect } from 'chai';
|
|
2
|
-
import { parseDimensionsIds } from '../src/rules/src/table/preparators/parseDimensionsIds';
|
|
3
|
-
|
|
4
|
-
describe('parseDimensionsIds', () => {
|
|
5
|
-
it('basic test', () => {
|
|
6
|
-
const dimensions = [
|
|
7
|
-
{},
|
|
8
|
-
{ id: 'a' },
|
|
9
|
-
{ id: 'b', values: [] },
|
|
10
|
-
{ id: 'c', values: [{}] },
|
|
11
|
-
{ id: 'd', values: [{}, {}] },
|
|
12
|
-
{ id: 'e', values: [{}, {}, {}] },
|
|
13
|
-
{ id: 'f', values: [{}] }
|
|
14
|
-
];
|
|
15
|
-
expect(parseDimensionsIds(dimensions)).to.deep.equal({
|
|
16
|
-
oneValue: { c: 3, f: 6 },
|
|
17
|
-
manyValues: { d: 4, e: 5 }
|
|
18
|
-
});
|
|
19
|
-
});
|
|
20
|
-
});
|
package/test/prepareData.test.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { expect } from 'chai';
|
|
2
|
-
import { prepareData } from '../src/rules/src/table/preparators/prepareData';
|
|
3
|
-
|
|
4
|
-
describe('prepareData tests', () => {
|
|
5
|
-
it('blank test', () => {
|
|
6
|
-
expect(prepareData(
|
|
7
|
-
{ data: undefined },
|
|
8
|
-
{},
|
|
9
|
-
{ defaultCodes: [], annotationsDefinitionCodes: {} }
|
|
10
|
-
)).to.deep.equal({
|
|
11
|
-
advancedAttributes: {},
|
|
12
|
-
dimensions: { one: {}, many: {}, length: 0 },
|
|
13
|
-
units: {
|
|
14
|
-
headerUnits: [],
|
|
15
|
-
rejectedValueIds: [],
|
|
16
|
-
unitsDefinitionCodes: [],
|
|
17
|
-
unitsAttachmentSeriesIds: [],
|
|
18
|
-
unitsSeries: {},
|
|
19
|
-
},
|
|
20
|
-
metadataCoordinates: [],
|
|
21
|
-
observations: {},
|
|
22
|
-
observationsType: undefined,
|
|
23
|
-
dataflowAttributes: {},
|
|
24
|
-
dataflowName: undefined,
|
|
25
|
-
seriesAttributes: [],
|
|
26
|
-
seriesAttributesValues: {}
|
|
27
|
-
});
|
|
28
|
-
});
|
|
29
|
-
});
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { expect } from 'chai';
|
|
2
|
-
import { refineObservationsAttributesValues } from '../src/rules/src/table/preparators/refineObservationsAttributesValues';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const attributesByIds = {
|
|
6
|
-
a: { id: 'a', values: [{ id: 'a1' }] },
|
|
7
|
-
b: { id: 'b', values: [{ id: 'b1' }, { id: 'b2', annotations: [1, 3, 5] }] }
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
const attributesOccurences = {
|
|
11
|
-
o1: { a: [0, 0, 0, 0, 0], b: [3, 3, 3, 3, 3, 3, 3] },
|
|
12
|
-
o2: { a: [0, 0, 0, null], b: [] },
|
|
13
|
-
o3: { b: [0, 0] },
|
|
14
|
-
o4: { a: [0], b: [1, 1, 1], c: [4, 4, 4, 4, 4] },
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
describe('refineObservationsAttributesValues test', () => {
|
|
18
|
-
it('valid plus non existin value case', () => {
|
|
19
|
-
expect(
|
|
20
|
-
refineObservationsAttributesValues(attributesByIds)({ a: [0, 0, 0, 0, 0], b: [3, 3, 3, 3, 3, 3, 3] })
|
|
21
|
-
).to.deep.equal({ a: { id: 'a', value: { id: 'a1' } } });
|
|
22
|
-
});
|
|
23
|
-
it('different indexes and no index case', () => {
|
|
24
|
-
expect(
|
|
25
|
-
refineObservationsAttributesValues(attributesByIds)({ a: [0, 0, 0, null], b: [] })
|
|
26
|
-
).to.deep.equal({});
|
|
27
|
-
});
|
|
28
|
-
it('valids plus unknown atrtibute case', () => {
|
|
29
|
-
expect(
|
|
30
|
-
refineObservationsAttributesValues(attributesByIds)({ a: [0], b: [1, 1, 1], c: [4, 4, 4, 4, 4] })
|
|
31
|
-
).to.deep.equal({ a: { id: 'a', value: { id: 'a1' } }, b: { id: 'b', value: { id: 'b2' } } });
|
|
32
|
-
});
|
|
33
|
-
});
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { expect } from 'chai';
|
|
2
|
-
import { invertTime } from '../src/rules2/src/invertTime';
|
|
3
|
-
import data from './mocks/table-invert-time--data.json';
|
|
4
|
-
import inverted from './mocks/table-invert-time--inverted.json';
|
|
5
|
-
|
|
6
|
-
describe('invertTime performace test', () => {
|
|
7
|
-
it('260 time period values and 2500 observations', function () {
|
|
8
|
-
this.timeout(3000);
|
|
9
|
-
expect(invertTime(data, true)).to.deep.equal(inverted);
|
|
10
|
-
});
|
|
11
|
-
});
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import { expect } from 'chai';
|
|
2
|
-
import { getSortedLayoutIndexes } from '../src/rules/src/table/factories/getSortedLayoutIndexes';
|
|
3
|
-
import { refineLayoutSize } from '../src/rules/src/table/factories/refineLayoutSize';
|
|
4
|
-
import { getLayoutData } from '../src/rules/src/table/factories/getLayoutData';
|
|
5
|
-
import multiHierRowsLayout from './mocks/table-layout-multi-hierarchies--layout.json'
|
|
6
|
-
import multiHierRowsObs from './mocks/table-layout-multi-hierarchies--observations.json'
|
|
7
|
-
import multiHierRowsLayoutIndexes from './mocks/table-layout-multi-hierarchies--layoutIndexes.json'
|
|
8
|
-
import multiHierRowsSizedIndexes from './mocks/table-layout-multi-hierarchies--sizedIndexes.json'
|
|
9
|
-
import multiHierRowsLayoutData from './mocks/table-layout-multi-hierarchies--layoutData.json'
|
|
10
|
-
import truncation1Layout from './mocks/table-layout-truncation1--layout.json'
|
|
11
|
-
import truncation1Obs from './mocks/table-layout-truncation1--observations.json'
|
|
12
|
-
import truncation1LayoutIndexes from './mocks/table-layout-truncation1--layoutIndexes.json'
|
|
13
|
-
import truncation1SizedIndexes from './mocks/table-layout-truncation1--sizedIndexes.json'
|
|
14
|
-
import truncation1LayoutData from './mocks/table-layout-truncation1--layoutData.json'
|
|
15
|
-
import * as R from 'ramda';
|
|
16
|
-
|
|
17
|
-
describe('table LayoutData performance tests', () => {
|
|
18
|
-
it('multi hierarchical rows getSortedLayoutIndexes test', function() {
|
|
19
|
-
this.timeout(2000);
|
|
20
|
-
expect(
|
|
21
|
-
getSortedLayoutIndexes(multiHierRowsLayout, multiHierRowsObs)
|
|
22
|
-
).to.deep.equal(multiHierRowsLayoutIndexes);
|
|
23
|
-
});
|
|
24
|
-
it('multi hierarchical rows refineLayoutSize test', function() {
|
|
25
|
-
this.timeout(2000);
|
|
26
|
-
expect(
|
|
27
|
-
refineLayoutSize({ layout: multiHierRowsLayout, observations: multiHierRowsObs, limit: 3000 })(multiHierRowsLayoutIndexes)
|
|
28
|
-
).to.deep.equal(multiHierRowsSizedIndexes);
|
|
29
|
-
});
|
|
30
|
-
it('multi hierarchical rows getLayoutData test', function() {
|
|
31
|
-
this.timeout(2000);
|
|
32
|
-
expect(
|
|
33
|
-
getLayoutData(multiHierRowsSizedIndexes, multiHierRowsLayout)
|
|
34
|
-
).to.deep.equal(multiHierRowsLayoutData);
|
|
35
|
-
});
|
|
36
|
-
it('multi hierarchical rows test', function() {
|
|
37
|
-
this.timeout(2000);
|
|
38
|
-
expect(
|
|
39
|
-
R.pipe(
|
|
40
|
-
getSortedLayoutIndexes,
|
|
41
|
-
refineLayoutSize({ layout: multiHierRowsLayout, observations: multiHierRowsObs, limit: 3000 }),
|
|
42
|
-
indexes => getLayoutData(indexes, multiHierRowsLayout)
|
|
43
|
-
)(multiHierRowsLayout, multiHierRowsObs)
|
|
44
|
-
).to.deep.equal(multiHierRowsLayoutData);
|
|
45
|
-
});
|
|
46
|
-
it('truncation1 getSortedLayoutIndexes test', function() {
|
|
47
|
-
this.timeout(2000);
|
|
48
|
-
expect(
|
|
49
|
-
getSortedLayoutIndexes(truncation1Layout, truncation1Obs)
|
|
50
|
-
).to.deep.equal(truncation1LayoutIndexes);
|
|
51
|
-
});
|
|
52
|
-
it('truncation1 refineLayoutSize test', function() {
|
|
53
|
-
this.timeout(2000);
|
|
54
|
-
expect(
|
|
55
|
-
refineLayoutSize({ layout: truncation1Layout, observations: truncation1Obs, limit: 3000 })(truncation1LayoutIndexes)
|
|
56
|
-
).to.deep.equal(truncation1SizedIndexes);
|
|
57
|
-
});
|
|
58
|
-
it('truncation1 getLayoutData test', function() {
|
|
59
|
-
this.timeout(2000);
|
|
60
|
-
expect(
|
|
61
|
-
getLayoutData(truncation1SizedIndexes, truncation1Layout)
|
|
62
|
-
).to.deep.equal(truncation1LayoutData);
|
|
63
|
-
});
|
|
64
|
-
it('truncation1 test', function() {
|
|
65
|
-
this.timeout(2500);
|
|
66
|
-
expect(
|
|
67
|
-
R.pipe(
|
|
68
|
-
getSortedLayoutIndexes,
|
|
69
|
-
refineLayoutSize({ layout: truncation1Layout, observations: truncation1Obs, limit: 3000 }),
|
|
70
|
-
indexes => getLayoutData(indexes, truncation1Layout)
|
|
71
|
-
)(truncation1Layout, truncation1Obs)
|
|
72
|
-
).to.deep.equal(truncation1LayoutData);
|
|
73
|
-
});
|
|
74
|
-
});
|