@sis-cc/dotstatsuite-components 16.1.1 → 16.1.3

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 (42) hide show
  1. package/lib/rules2/src/constants.js +2 -1
  2. package/lib/rules2/src/enhanceObservations.js +5 -4
  3. package/lib/rules2/src/getAttributesSeries.js +7 -0
  4. package/lib/rules2/src/getCombinationDefinitions.js +25 -19
  5. package/lib/rules2/src/getDataflowAttributes.js +34 -0
  6. package/lib/rules2/src/getHeaderTitle.js +29 -0
  7. package/lib/rules2/src/getOneValueDimensions.js +3 -1
  8. package/lib/rules2/src/getSidebarData.js +8 -17
  9. package/lib/rules2/src/index.js +27 -0
  10. package/lib/rules2/src/parseCombinations.js +4 -2
  11. package/lib/rules2/src/prepareData.js +33 -2
  12. package/lib/rules2/src/table/getCells.js +4 -2
  13. package/lib/rules2/src/table/getCellsMetadataCoordinates.js +30 -0
  14. package/lib/rules2/src/table/getCombinationDimensionsData.js +5 -4
  15. package/lib/rules2/src/table/getLayoutData.js +15 -6
  16. package/lib/rules2/src/table/parseValueHierarchy.js +9 -8
  17. package/package.json +1 -1
  18. package/src/rules2/src/constants.js +1 -0
  19. package/src/rules2/src/enhanceObservations.js +4 -4
  20. package/src/rules2/src/getAttributesSeries.js +7 -0
  21. package/src/rules2/src/getCombinationDefinitions.js +20 -18
  22. package/src/rules2/src/getDataflowAttributes.js +23 -0
  23. package/src/rules2/src/getHeaderTitle.js +15 -0
  24. package/src/rules2/src/getOneValueDimensions.js +2 -1
  25. package/src/rules2/src/getSidebarData.js +4 -12
  26. package/src/rules2/src/index.js +3 -0
  27. package/src/rules2/src/parseCombinations.js +5 -2
  28. package/src/rules2/src/prepareData.js +22 -4
  29. package/src/rules2/src/table/getCells.js +4 -2
  30. package/src/rules2/src/table/getCellsMetadataCoordinates.js +13 -0
  31. package/src/rules2/src/table/getCombinationDimensionsData.js +5 -4
  32. package/src/rules2/src/table/getLayoutData.js +13 -5
  33. package/src/rules2/src/table/parseValueHierarchy.js +7 -8
  34. package/test/getAttributesSeries.test.js +2 -0
  35. package/test/getCells.test.js +1 -0
  36. package/test/getCellsMetadataCoordinates.test.js +40 -0
  37. package/test/getCombinationDimensionsData.test.js +7 -2
  38. package/test/getDataflowAttributes.test.js +23 -0
  39. package/test/getHeaderTitle.test.js +25 -0
  40. package/test/getLayoutData.test.js +130 -0
  41. package/test/parseCombinations.test.js +36 -0
  42. package/test/parseValueHierarchy.test.js +54 -4
@@ -0,0 +1,36 @@
1
+ import { expect } from 'chai';
2
+ import { parseCombinations } from '../src/rules2/src/';
3
+
4
+ describe('parseCombinations tests', () => {
5
+ it('complete case', () => {
6
+ const combinations = [
7
+ { id: 'COMB1', concepts: ['DIM1', 'DIM2'] },
8
+ { id: 'COMB2', concepts: ['DIM3', 'DIM4'] },
9
+ { id: 'COMB3', concepts: ['ATTR1', 'ATTR2'] },
10
+ { id: 'COMB4', concepts: ['ATTR3', 'ATTR4'] },
11
+ { id: 'COMB5', concepts: ['DIM1', 'ATTR4'] },
12
+ ];
13
+
14
+ const dimensions = [
15
+ { id: 'DIM1', values: [{ id: 'v1' }] },
16
+ { id: 'DIM2', values: [{ id: 'v1' }] },
17
+ { id: 'DIM3', values: [{ id: 'v1' }, { id: 'v2' }] },
18
+ { id: 'DIM4', values: [{ id: 'v1' }, { id: 'v2' }] },
19
+ ];
20
+
21
+ const attributes = [
22
+ { id: 'ATTR1', header: true, relationship: [] },
23
+ { id: 'ATTR2', header: true, relationship: ['DIM1'] },
24
+ { id: 'ATTR3', header: true, relationship: [] },
25
+ { id: 'ATTR4', series: true, relationship: ['DIM3', 'DIM4'] },
26
+ ];
27
+
28
+ expect(parseCombinations(combinations, attributes, dimensions)).to.deep.equal([
29
+ { id: 'COMB1', concepts: ['DIM1', 'DIM2'], header: true },
30
+ { id: 'COMB2', concepts: ['DIM3', 'DIM4'], series: true, relationship: ['DIM3', 'DIM4'] },
31
+ { id: 'COMB3', concepts: ['ATTR1', 'ATTR2'], header: true },
32
+ { id: 'COMB4', concepts: ['ATTR3', 'ATTR4'], series: true, relationship: ['DIM3', 'DIM4'] },
33
+ { id: 'COMB5', concepts: ['DIM1', 'ATTR4'] , series: true, relationship: ['DIM3', 'DIM4'] },
34
+ ]);
35
+ });
36
+ });
@@ -15,6 +15,26 @@ describe('parseValueHierarchy tests', () => {
15
15
  const previousValue = { id: 'IDF', parents: ['OECD', 'FRA'] };
16
16
  expect(parseValueHierarchy(value, previousValue, indexedValues)).to.deep.equal(value);
17
17
  });
18
+ it('previous is self', () => {
19
+ const value = { id: 'GER', parents: ['OECD'] };
20
+ const previousValue = { id: 'GER', parentsIds: ['OECD'], missingParents: [], parents: [{ id: 'OECD' }] };
21
+ expect(parseValueHierarchy(value, previousValue, indexedValues)).to.deep.equal({
22
+ id: 'GER',
23
+ parents: [{ id: 'OECD' }],
24
+ parentsIds: ['OECD'],
25
+ missingParents: []
26
+ });
27
+ });
28
+ it('previous is self with missing parent', () => {
29
+ const value = { id: 'GER', parents: ['OECD'] };
30
+ const previousValue = { id: 'GER', parentsIds: ['OECD'], missingParents: [{ id: 'OECD' }], parents: [] };
31
+ expect(parseValueHierarchy(value, previousValue, indexedValues)).to.deep.equal({
32
+ id: 'GER',
33
+ parents: [],
34
+ parentsIds: ['OECD'],
35
+ missingParents: [{ id: 'OECD' }]
36
+ });
37
+ });
18
38
  it('previous is parent', () => {
19
39
  const value = { id: 'IDF', parents: ['OECD', 'FRA'] };
20
40
  const previousValue = { id: 'FRA', parents: [{ id: 'OECD' }], parentsIds: ['OECD'], missingParents: [] };
@@ -47,7 +67,7 @@ describe('parseValueHierarchy tests', () => {
47
67
  });
48
68
  it('previous is bro', () => {
49
69
  const value = { id: 'FRA', parents: ['OECD'] };
50
- const previousValue = { id: 'FRA', parentsIds: ['OECD'], missingParents: [], parents: [{ id: 'OECD' }] };;
70
+ const previousValue = { id: 'FRA', parentsIds: ['OECD'], missingParents: [], parents: [{ id: 'OECD' }] };
51
71
  expect(parseValueHierarchy(value, previousValue, indexedValues)).to.deep.equal({
52
72
  id: 'FRA',
53
73
  parents: [{ id: 'OECD' }],
@@ -57,7 +77,7 @@ describe('parseValueHierarchy tests', () => {
57
77
  });
58
78
  it('previous is bro with missing parent', () => {
59
79
  const value = { id: 'FRA', parents: ['OECD'] };
60
- const previousValue = { id: 'FRA', parentsIds: ['OECD'], missingParents: [{ id: 'OECD' }], parents: [] };;
80
+ const previousValue = { id: 'GER', parentsIds: ['OECD'], missingParents: [{ id: 'OECD' }], parents: [] };
61
81
  expect(parseValueHierarchy(value, previousValue, indexedValues)).to.deep.equal({
62
82
  id: 'FRA',
63
83
  parents: [],
@@ -67,7 +87,7 @@ describe('parseValueHierarchy tests', () => {
67
87
  });
68
88
  it('previous is parent but in different hierarchy', () => {
69
89
  const value = { id: 'IDF', parents: ['OECD', 'FRA'] };
70
- const previousValue = { id: 'FRA', parentsIds: ['EU'], missingParents: [], parents: [{ id: 'EU' }] };;
90
+ const previousValue = { id: 'FRA', parentsIds: ['EU'], missingParents: [], parents: [{ id: 'EU' }] };
71
91
  expect(parseValueHierarchy(value, previousValue, indexedValues)).to.deep.equal({
72
92
  id: 'IDF',
73
93
  parents: [],
@@ -77,7 +97,7 @@ describe('parseValueHierarchy tests', () => {
77
97
  });
78
98
  it('previous is bro but in different hierarchy', () => {
79
99
  const value = { id: 'IDF', parents: ['OECD', 'FRA'] };
80
- const previousValue = { id: 'BRE', parentsIds: ['EU', 'FRA'], missingParents: [], parents: [{ id: 'EU' }, { id: 'FRA' }] };;
100
+ const previousValue = { id: 'BRE', parentsIds: ['EU', 'FRA'], missingParents: [], parents: [{ id: 'EU' }, { id: 'FRA' }] };
81
101
  expect(parseValueHierarchy(value, previousValue, indexedValues)).to.deep.equal({
82
102
  id: 'IDF',
83
103
  parents: [],
@@ -85,4 +105,34 @@ describe('parseValueHierarchy tests', () => {
85
105
  missingParents: [{ id: 'OECD' }, { id: 'FRA' }]
86
106
  });
87
107
  });
108
+ it('previous is nephew but there is missing ids on top', () => {
109
+ const value = { id: 'GER', parents: ['OECD'] };
110
+ const previousValue = { id: 'IDF', parentsIds: ['OECD', 'FRA'], missingParents: [], parents: [{ id: 'OECD' }, { id: 'FRA' }] };
111
+ expect(parseValueHierarchy(value, previousValue, indexedValues)).to.deep.equal({
112
+ id: 'GER',
113
+ parents: [{ id: 'OECD' }],
114
+ parentsIds: ['OECD'],
115
+ missingParents: []
116
+ });
117
+ });
118
+ it('previous is nephew but there is missing ids on top', () => {
119
+ const value = { id: 'GER', parents: ['OECD'] };
120
+ const previousValue = { id: 'IDF', parentsIds: ['OECD', 'FRA'], missingParents: [], parents: [{ id: 'FRA' }] };
121
+ expect(parseValueHierarchy(value, previousValue, indexedValues)).to.deep.equal({
122
+ id: 'GER',
123
+ parents: [],
124
+ parentsIds: ['OECD'],
125
+ missingParents: [{ id: 'OECD' }]
126
+ });
127
+ });
128
+ it('previous is nephew with missing parent and missing ids on top', () => {
129
+ const value = { id: 'GER', parents: ['OECD'] };
130
+ const previousValue = { id: 'IDF', parentsIds: ['OECD', 'FRA'], missingParents: [{ id: 'OECD' }, { id: 'FRA' }], parents: [] };
131
+ expect(parseValueHierarchy(value, previousValue, indexedValues)).to.deep.equal({
132
+ id: 'GER',
133
+ parents: [],
134
+ parentsIds: ['OECD'],
135
+ missingParents: [{ id: 'OECD' }]
136
+ });
137
+ });
88
138
  });