@sis-cc/dotstatsuite-components 16.1.4 → 16.1.6

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.
@@ -77,5 +77,7 @@ var formatValue = exports.formatValue = function formatValue(observation, format
77
77
  })(decimals));
78
78
  }, formatSeparator);
79
79
 
80
- return R.ifElse(isValidNumber, R.pipe(formatScale, formatDecimals), R.always('..'))(observation.value);
80
+ return R.ifElse(isValidNumber, R.pipe(formatScale, formatDecimals, function (res) {
81
+ return res === 'NaN' ? String(value) : res;
82
+ }), R.always('..'))(observation.value);
81
83
  };
@@ -17,7 +17,7 @@ var getHeaderCombinations = exports.getHeaderCombinations = function getHeaderCo
17
17
  var indexedDimensions = R.indexBy(R.prop('id'), dimensions);
18
18
  var indexedAttributes = R.indexBy(R.prop('id'), attributes);
19
19
  return R.reduce(function (acc, comb) {
20
- if (!R.prop('header', comb)) {
20
+ if (!R.prop('header', comb) || !R.propOr(true, 'display', comb)) {
21
21
  return acc;
22
22
  }
23
23
 
@@ -25,11 +25,11 @@ var getHeaderCombinations = exports.getHeaderCombinations = function getHeaderCo
25
25
 
26
26
  var values = R.pipe(R.reduce(function (_acc, concept) {
27
27
  var artefact = R.has(concept, indexedDimensions) ? R.prop(concept, indexedDimensions) : R.prop(concept, indexedAttributes);
28
- if (R.isNil(artefact) || !R.prop('display', artefact || {})) {
28
+ if (R.isNil(artefact) || !R.propOr(true, 'display', artefact || {})) {
29
29
  return _acc;
30
30
  }
31
31
  var value = R.path(['values', 0], artefact);
32
- if (R.isNil(value) || !R.prop('display', value || {})) {
32
+ if (R.isNil(value) || !R.propOr(true, 'display', value || {})) {
33
33
  return _acc;
34
34
  }
35
35
  return R.append((0, _src.dimensionValueDisplay)(display)(value), _acc);
@@ -25,11 +25,11 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
25
25
 
26
26
  var getOneValueDimensions = exports.getOneValueDimensions = function getOneValueDimensions(dimensions, attributes) {
27
27
  var indexedRelevantAttributes = R.reduce(function (acc, attr) {
28
- if (!attr.header || !attr.display || R.length(attr.relationship || []) !== 1) {
28
+ if (!attr.header || !R.propOr(true, 'display', attr) || R.length(attr.relationship || []) !== 1) {
29
29
  return acc;
30
30
  }
31
31
  var value = R.path(['values', 0], attr);
32
- if (R.isNil(value) || !R.prop('display', value) || R.includes(R.prop('id', value), _constants.REJECTED_VALUE_IDS)) {
32
+ if (R.isNil(value) || !R.propOr(true, 'display', value) || R.includes(R.prop('id', value), _constants.REJECTED_VALUE_IDS)) {
33
33
  return acc;
34
34
  }
35
35
  var dim = R.head(attr.relationship);
@@ -39,7 +39,7 @@ var getOneValueDimensions = exports.getOneValueDimensions = function getOneValue
39
39
  })(acc);
40
40
  }, {}, attributes);
41
41
  return R.reduce(function (acc, dim) {
42
- if (R.length(dim.values || []) !== 1) {
42
+ if (R.length(dim.values || []) !== 1 || !R.propOr(true, 'display', dim) || !R.pathOr(true, ['values', 0, 'display'], dim) || R.includes(R.path(['values', 0, 'id'], dim), _constants.REJECTED_VALUE_IDS)) {
43
43
  return acc;
44
44
  }
45
45
  var attrValues = R.propOr({}, dim.id, indexedRelevantAttributes);
@@ -17,17 +17,26 @@ var _ramda = require('ramda');
17
17
 
18
18
  var R = _interopRequireWildcard(_ramda);
19
19
 
20
+ var _constants = require('./constants');
21
+
20
22
  function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
21
23
 
22
24
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
23
25
 
26
+ var getDisplayableValues = function getDisplayableValues(values) {
27
+ return R.filter(function (val) {
28
+ return !R.includes(R.prop('id', val), _constants.REJECTED_VALUE_IDS) && R.propOr(true, 'display', val);
29
+ }, values);
30
+ };
31
+
24
32
  var parseCombinations = exports.parseCombinations = function parseCombinations(combinations, parsedAttributes, dimensions) {
25
33
  var indexedDimensions = R.indexBy(R.prop('id'), dimensions);
26
34
  var indexedAttributes = R.indexBy(R.prop('id'), parsedAttributes);
27
35
 
28
- return R.map(function (comb) {
36
+ return R.reduce(function (acc, comb) {
29
37
  var relationship = [];
30
38
  var ids = {};
39
+ var displayable_values_count = 0;
31
40
  var seriesConcepts = R.filter(function (concept) {
32
41
  if (R.has(concept, ids)) {
33
42
  return false;
@@ -36,6 +45,8 @@ var parseCombinations = exports.parseCombinations = function parseCombinations(c
36
45
  var values = R.path([concept, 'values'], indexedDimensions);
37
46
  relationship = R.length(values) > 1 ? R.append(concept, relationship) : relationship;
38
47
  ids = (0, _extends4.default)({}, ids, (0, _defineProperty3.default)({}, concept, concept));
48
+ var _displayableValues = getDisplayableValues(values);
49
+ displayable_values_count = R.pathOr(true, [concept, 'display'], indexedDimensions) ? displayable_values_count + R.length(_displayableValues) : displayable_values_count;
39
50
  return R.length(values) > 1;
40
51
  } else if (!R.has(concept, indexedAttributes)) {
41
52
  return false;
@@ -45,12 +56,13 @@ var parseCombinations = exports.parseCombinations = function parseCombinations(c
45
56
  return R.has(id, ids);
46
57
  }), R.concat(relationship))(attribute.relationship) : relationship;
47
58
  ids = attribute.series ? (0, _extends4.default)({}, ids, R.indexBy(R.identity, attribute.relationship)) : ids;
59
+ var displayableValues = getDisplayableValues(attribute.values || []);
60
+ displayable_values_count = R.propOr(true, 'display', attribute) ? displayable_values_count + R.length(displayableValues) : displayable_values_count;
48
61
  return attribute.series;
49
62
  }, comb.concepts);
50
-
51
63
  if (R.isEmpty(seriesConcepts)) {
52
- return (0, _extends4.default)({}, comb, { header: true });
64
+ return R.append((0, _extends4.default)({}, comb, { header: true, display: displayable_values_count > 0 }), acc);
53
65
  }
54
- return (0, _extends4.default)({}, comb, { series: true, relationship: relationship });
55
- }, combinations);
66
+ return R.append((0, _extends4.default)({}, comb, { series: true, relationship: relationship, display: displayable_values_count > 0 }), acc);
67
+ }, [], combinations);
56
68
  };
@@ -130,14 +130,17 @@ var getSubLayoutData = function getSubLayoutData(series, _definition, _ref) {
130
130
  return isValid ? (0, _extends3.default)({}, acc, R.length(splitKey) === 1 ? R.pick(combinationConceptIds, R.prop(key, attributesSeries)) : R.prop(key, attributesSeries)) : acc;
131
131
  }, {}, R.keys(attributesSeries));
132
132
 
133
- data = R.addIndex(R.map)(function (entry, ind) {
133
+ data = R.addIndex(R.reduce)(function (acc, entry, ind) {
134
134
  if (!R.has('dimValues', entry)) {
135
- return entry;
135
+ return R.append(entry, acc);
136
136
  }
137
137
  var dimValues = entry.dimValues,
138
138
  dimension = entry.dimension;
139
139
 
140
140
  var def = R.nth(ind, definition);
141
+ if (!R.propOr(true, 'display', def)) {
142
+ return acc;
143
+ }
141
144
  var fixedDimValues = R.propOr([], 'fixedDimValues', def);
142
145
  var values = R.reduce(function (_acc, id) {
143
146
  if (R.has(id, dimValues)) {
@@ -155,8 +158,8 @@ var getSubLayoutData = function getSubLayoutData(series, _definition, _ref) {
155
158
  }
156
159
  return R.append(R.path([id, 'value'], attributesValues), _acc);
157
160
  }, [], def.concepts);
158
- return { dimension: dimension, values: values };
159
- }, data);
161
+ return R.append({ dimension: dimension, values: values }, acc);
162
+ }, [], data);
160
163
 
161
164
  var layoutAttrValues = R.pipe(R.omit(combinationConceptIds), R.reject(R.prop('isObs')))(attributesValues);
162
165
 
@@ -13,7 +13,7 @@ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj;
13
13
 
14
14
  var trimedProps = exports.trimedProps = function trimedProps(properties, obj) {
15
15
  return R.reduce(function (acc, prop) {
16
- if (!R.has(prop, obj)) {
16
+ if (R.isNil(R.prop(prop, obj))) {
17
17
  return acc;
18
18
  }
19
19
  return R.append(obj[prop], acc);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sis-cc/dotstatsuite-components",
3
3
  "description": "Set components based on React.",
4
- "version": "16.1.4",
4
+ "version": "16.1.6",
5
5
  "main": "lib/index.js",
6
6
  "author": "OECD",
7
7
  "license": "MIT",
@@ -77,6 +77,7 @@ export const formatValue = (observation, formatAttributesIndexes, attributes) =>
77
77
  R.pipe(
78
78
  formatScale,
79
79
  formatDecimals,
80
+ res => res === 'NaN' ? String(value) : res
80
81
  ),
81
82
  R.always('..')
82
83
  )(observation.value);
@@ -6,7 +6,7 @@ export const getHeaderCombinations = (combinations, dimensions, attributes, disp
6
6
  const indexedAttributes = R.indexBy(R.prop('id'), attributes);
7
7
  return R.reduce(
8
8
  (acc, comb) => {
9
- if (!R.prop('header', comb)) {
9
+ if (!R.prop('header', comb) || !R.propOr(true, 'display', comb)) {
10
10
  return acc;
11
11
  }
12
12
 
@@ -17,11 +17,11 @@ export const getHeaderCombinations = (combinations, dimensions, attributes, disp
17
17
  const artefact = R.has(concept, indexedDimensions)
18
18
  ? R.prop(concept, indexedDimensions)
19
19
  : R.prop(concept, indexedAttributes);
20
- if (R.isNil(artefact) || !R.prop('display', artefact || {})) {
20
+ if (R.isNil(artefact) || !R.propOr(true, 'display', artefact || {})) {
21
21
  return _acc;
22
22
  }
23
23
  const value = R.path(['values', 0], artefact);
24
- if (R.isNil(value) || !R.prop('display', value || {})) {
24
+ if (R.isNil(value) || !R.propOr(true, 'display', value || {})) {
25
25
  return _acc;
26
26
  }
27
27
  return R.append(dimensionValueDisplay(display)(value), _acc);
@@ -4,11 +4,11 @@ import { REJECTED_VALUE_IDS } from './constants';
4
4
  export const getOneValueDimensions = (dimensions, attributes) => {
5
5
  const indexedRelevantAttributes = R.reduce(
6
6
  (acc, attr) => {
7
- if (!attr.header || !attr.display || R.length(attr.relationship || []) !== 1) {
7
+ if (!attr.header || !R.propOr(true, 'display', attr) || R.length(attr.relationship || []) !== 1) {
8
8
  return acc;
9
9
  }
10
10
  const value = R.path(['values', 0], attr);
11
- if (R.isNil(value) || !R.prop('display', value) || R.includes(R.prop('id', value), REJECTED_VALUE_IDS)) {
11
+ if (R.isNil(value) || !R.propOr(true, 'display', value) || R.includes(R.prop('id', value), REJECTED_VALUE_IDS)) {
12
12
  return acc;
13
13
  }
14
14
  const dim = R.head(attr.relationship);
@@ -22,7 +22,8 @@ export const getOneValueDimensions = (dimensions, attributes) => {
22
22
  );
23
23
  return R.reduce(
24
24
  (acc, dim) => {
25
- if (R.length(dim.values || []) !== 1) {
25
+ if (R.length(dim.values || []) !== 1 || !R.propOr(true, 'display', dim) || !R.pathOr(true, ['values', 0, 'display'], dim)
26
+ || R.includes(R.path(['values', 0, 'id'], dim), REJECTED_VALUE_IDS)) {
26
27
  return acc;
27
28
  }
28
29
  const attrValues = R.propOr({}, dim.id, indexedRelevantAttributes);
@@ -1,39 +1,60 @@
1
1
  import * as R from 'ramda';
2
+ import { REJECTED_VALUE_IDS } from './constants';
3
+
4
+ const getDisplayableValues = values => R.filter(
5
+ val => !R.includes(R.prop('id', val), REJECTED_VALUE_IDS) && R.propOr(true, 'display', val),
6
+ values
7
+ );
2
8
 
3
9
  export const parseCombinations = (combinations, parsedAttributes, dimensions) => {
4
10
  const indexedDimensions = R.indexBy(R.prop('id'), dimensions);
5
11
  const indexedAttributes = R.indexBy(R.prop('id'), parsedAttributes);
6
12
 
7
- return R.map(comb => {
8
- let relationship = [];
9
- let ids = {};
10
- const seriesConcepts = R.filter(concept => {
11
- if (R.has(concept, ids)) {
12
- return false;
13
- }
14
- if (R.has(concept, indexedDimensions)) {
15
- const values = R.path([concept, 'values'], indexedDimensions);
16
- relationship = R.length(values) > 1 ? R.append(concept, relationship) : relationship;
17
- ids = { ...ids, [concept]: concept };
18
- return R.length(values) > 1;
13
+ return R.reduce(
14
+ (acc, comb) => {
15
+ let relationship = [];
16
+ let ids = {};
17
+ let displayable_values_count = 0;
18
+ const seriesConcepts = R.filter(
19
+ concept => {
20
+ if (R.has(concept, ids)) {
21
+ return false;
22
+ }
23
+ if (R.has(concept, indexedDimensions)) {
24
+ const values = R.path([concept, 'values'], indexedDimensions);
25
+ relationship = R.length(values) > 1 ? R.append(concept, relationship) : relationship;
26
+ ids = { ...ids, [concept]: concept };
27
+ const displayableValues = getDisplayableValues(values);
28
+ displayable_values_count = R.pathOr(true, [concept, 'display'], indexedDimensions)
29
+ ? displayable_values_count + R.length(displayableValues)
30
+ : displayable_values_count;
31
+ return R.length(values) > 1;
32
+ }
33
+ else if (!R.has(concept, indexedAttributes)) {
34
+ return false;
35
+ }
36
+ const attribute = R.prop(concept, indexedAttributes);
37
+ relationship = attribute.series
38
+ ? R.pipe(
39
+ R.reject(id => R.has(id, ids)),
40
+ R.concat(relationship),
41
+ )(attribute.relationship)
42
+ : relationship;
43
+ ids = attribute.series ? { ...ids, ...R.indexBy(R.identity, attribute.relationship) } : ids;
44
+ const displayableValues = getDisplayableValues(attribute.values || []);
45
+ displayable_values_count = R.propOr(true, 'display', attribute)
46
+ ? displayable_values_count + R.length(displayableValues)
47
+ : displayable_values_count;
48
+ return attribute.series;
49
+ },
50
+ comb.concepts
51
+ );
52
+ if (R.isEmpty(seriesConcepts)) {
53
+ return R.append({ ...comb, header: true, display: displayable_values_count > 0 }, acc);
19
54
  }
20
- else if (!R.has(concept, indexedAttributes)) {
21
- return false;
22
- }
23
- const attribute = R.prop(concept, indexedAttributes);
24
- relationship = attribute.series
25
- ? R.pipe(
26
- R.reject(id => R.has(id, ids)),
27
- R.concat(relationship),
28
- )(attribute.relationship)
29
- : relationship;
30
- ids = attribute.series ? { ...ids, ...R.indexBy(R.identity, attribute.relationship) } : ids;
31
- return attribute.series;
32
- }, comb.concepts);
33
-
34
- if (R.isEmpty(seriesConcepts)) {
35
- return { ...comb, header: true };
36
- }
37
- return { ...comb, series: true, relationship };
38
- }, combinations);
55
+ return R.append({ ...comb, series: true, relationship, display: displayable_values_count > 0 }, acc);
56
+ },
57
+ [],
58
+ combinations
59
+ );
39
60
  };
@@ -107,13 +107,16 @@ const getSubLayoutData = (series, _definition, { metadataCoordinates, attributes
107
107
  R.keys(attributesSeries)
108
108
  );
109
109
 
110
- data = R.addIndex(R.map)(
111
- (entry, ind) => {
110
+ data = R.addIndex(R.reduce)(
111
+ (acc, entry, ind) => {
112
112
  if (!R.has('dimValues', entry)) {
113
- return entry;
113
+ return R.append(entry, acc);
114
114
  }
115
115
  const { dimValues, dimension } = entry;
116
116
  const def = R.nth(ind, definition);
117
+ if (!R.propOr(true, 'display', def)) {
118
+ return acc;
119
+ }
117
120
  const fixedDimValues = R.propOr([], 'fixedDimValues', def);
118
121
  const values = R.reduce(
119
122
  (_acc, id) => {
@@ -135,8 +138,9 @@ const getSubLayoutData = (series, _definition, { metadataCoordinates, attributes
135
138
  [],
136
139
  def.concepts
137
140
  );
138
- return ({ dimension, values });
141
+ return R.append({ dimension, values }, acc);
139
142
  },
143
+ [],
140
144
  data
141
145
  );
142
146
 
@@ -2,7 +2,7 @@ import * as R from 'ramda';
2
2
 
3
3
  export const trimedProps = (properties, obj) => R.reduce(
4
4
  (acc, prop) => {
5
- if (!R.has(prop, obj)) {
5
+ if (R.isNil(R.prop(prop, obj))) {
6
6
  return acc;
7
7
  }
8
8
  return R.append(obj[prop], acc);
@@ -0,0 +1,26 @@
1
+ import { expect } from 'chai';
2
+ import { getHeaderCombinations } from '../src/rules2/src/';
3
+
4
+ describe('getHeaderCombinations tests', () => {
5
+ it('complete test', () => {
6
+ const combinations = [
7
+ { id: 'COMB1', name: 'comb 1', header: true, concepts: ['DIM1', 'DIM2', 'ATTR1'] },
8
+ { id: 'COMB2', name: 'comb 2', series: true, concepts: ['DIM3', 'ATTR2'] },
9
+ { id: 'COMB3', name: 'comb 3', header: true, display: false, concepts: ['DIM3', 'ATTR2'] }
10
+ ];
11
+
12
+ const dimensions = [
13
+ { id: 'DIM1', name: 'dim 1', values: [{ id: 'v', name: 'dim 1 value' }] },
14
+ { id: 'DIM3', name: 'dim 3', values: [{ id: 'v', name: 'dim 3 value' }] },
15
+ ];
16
+
17
+ const attributes = [
18
+ { id: 'ATTR1', name: 'attr 1', values: [{ id: 'v', name: 'attr 1 value', display: false }] },
19
+ { id: 'ATTR2', name: 'attr 2', values: [{ id: 'v', name: 'attr 2 value' }] },
20
+ ];
21
+
22
+ expect(getHeaderCombinations(combinations, dimensions, attributes, 'label')).to.deep.equal([
23
+ { header: 'comb 1', label: 'dim 1 value' }
24
+ ]);
25
+ });
26
+ });
@@ -127,4 +127,59 @@ describe('getLayoutData tests', () => {
127
127
  ]
128
128
  })
129
129
  });
130
+ it('not displayed combination', () => {
131
+ const layout = {
132
+ header: [{ id: 'H', values: [{ id: 'H_V1' }, { id: 'H_V2' }] }],
133
+ sections: [],
134
+ rows: [
135
+ { id: 'R1', values: [{ id: 'R1_V1' }, { id: 'R1_V2' }] },
136
+ {
137
+ id: 'COMB',
138
+ display: false,
139
+ concepts: ['R2', 'ATTR'],
140
+ dimensions: [
141
+ { id: 'R2', values: [{ id: 'R2_V1' }, { id: 'R2_V2' }] },
142
+ ]
143
+ }
144
+ ]
145
+ };
146
+
147
+ const attributesSeries = {
148
+ 'R1=R1_V1:R2=R2_V1': {
149
+ ATTR: { id: 'ATTR', value: { id: 'ATTR_V1' }, coordinates: { R1: 'R1_V1', R2: 'R2_V1' } },
150
+ },
151
+ 'R1=R1_V2:R2=R2_V2': {
152
+ ATTR: { id: 'ATTR', value: { id: 'ATTR_V4' }, coordinates: { R1: 'R1_V2', R2: 'R2_V2' } },
153
+ },
154
+ };
155
+
156
+ const layoutIndexes = {
157
+ header: [[0], [1]],
158
+ sections: [
159
+ [
160
+ [],
161
+ [
162
+ [0, [0]],
163
+ [1, [1]]
164
+ ]
165
+ ]
166
+ ]
167
+ };
168
+
169
+ expect(getLayoutData(layoutIndexes, layout, { attributesSeries, metadataCoordinates: [], customAttributes: { flags: [], notes: [] } })).to.deep.equal({
170
+ headerData: [
171
+ { data: [{ dimension: { id: 'H' }, value: { id: 'H_V1' } }], key: 'H=H_V1', flags: [], sideProps: null, coordinates: { H: 'H_V1' } },
172
+ { data: [{ dimension: { id: 'H' }, value: { id: 'H_V2' } }], key: 'H=H_V2', flags: [], sideProps: null, coordinates: { H: 'H_V2' } }
173
+ ],
174
+ sectionsData: [
175
+ [
176
+ { data: [], key: '', flags: [], sideProps: null, coordinates: {} },
177
+ [
178
+ { data: [{ dimension: { id: 'R1' }, value: { id: 'R1_V1' } }], key: 'R1=R1_V1:R2=R2_V1', flags: [], sideProps: null, coordinates: { R1: 'R1_V1', R2: 'R2_V1' } },
179
+ { data: [{ dimension: { id: 'R1' }, value: { id: 'R1_V2' } }], key: 'R1=R1_V2:R2=R2_V2', flags: [], sideProps: null, coordinates: { R1: 'R1_V2', R2: 'R2_V2' } }
180
+ ]
181
+ ]
182
+ ]
183
+ });
184
+ });
130
185
  });
@@ -0,0 +1,29 @@
1
+ import { expect } from 'chai';
2
+ import { getOneValueDimensions } from '../src/rules2/src/';
3
+
4
+ describe('getOneValueDimensions tests', () => {
5
+ it('basic case', () => {
6
+ const attributes = [
7
+ { id: 'a0', header: true, values: [{ id: 'v' }] },
8
+ { id: 'a1', header: true, values: [{ id: 'v' }], relationship: ['d0'] },
9
+ { id: 'a2', header: true, values: [{ id: 'v' }], relationship: ['d0', 'd1'] },
10
+ { id: 'a3', display: false, header: true, values: [{ id: 'v' }], relationship: ['d0'] },
11
+ { id: 'a4', header: true, values: [{ id: 'v', display: false }], relationship: ['d0'] },
12
+ { id: 'a5', header: true, values: [{ id: '_Z' }], relationship: ['d0'] },
13
+ ];
14
+
15
+ const dimensions = [
16
+ { id: 'd0', values: [{ id: 'v' }] },
17
+ { id: 'd1', values: [{ id: 'v' }] },
18
+ { id: 'd2', display: false, values: [{ id: 'v' }] },
19
+ { id: 'd3', values: [{ id: 'v', display: false }] },
20
+ { id: 'd4', values: [{ id: '_T' }] },
21
+ { id: 'd5', values: [{ id: 'v0' }, { id: 'v1' }] },
22
+ ];
23
+
24
+ expect(getOneValueDimensions(dimensions, attributes)).to.deep.equal([
25
+ { id: 'd0', values: [{ id: 'v' }], attrValues: { a1: { id: 'a1', header: true, values: [{ id: 'v' }], relationship: ['d0'], value: { id: 'v' } } } },
26
+ { id: 'd1', values: [{ id: 'v' }], attrValues: {} },
27
+ ])
28
+ });
29
+ });
@@ -9,6 +9,7 @@ describe('parseCombinations tests', () => {
9
9
  { id: 'COMB3', concepts: ['ATTR1', 'ATTR2'] },
10
10
  { id: 'COMB4', concepts: ['ATTR3', 'ATTR4'] },
11
11
  { id: 'COMB5', concepts: ['DIM1', 'ATTR4'] },
12
+ { id: 'COMB6', concepts: ['DIM5', 'ATTR5'] }
12
13
  ];
13
14
 
14
15
  const dimensions = [
@@ -16,21 +17,24 @@ describe('parseCombinations tests', () => {
16
17
  { id: 'DIM2', values: [{ id: 'v1' }] },
17
18
  { id: 'DIM3', values: [{ id: 'v1' }, { id: 'v2' }] },
18
19
  { id: 'DIM4', values: [{ id: 'v1' }, { id: 'v2' }] },
20
+ { id: 'DIM5', values: [{ id: '_Z' }, { id: 'v2', display: false }] },
19
21
  ];
20
22
 
21
23
  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'] },
24
+ { id: 'ATTR1', header: true, relationship: [], values: [{ id: 'v' }] },
25
+ { id: 'ATTR2', header: true, relationship: ['DIM1'], values: [{ id: 'v' }] },
26
+ { id: 'ATTR3', header: true, relationship: [], values: [{ id: 'v' }] },
27
+ { id: 'ATTR4', series: true, relationship: ['DIM3', 'DIM4'], values: [{ id: 'v' }] },
28
+ { id: 'ATTR5', series: true, display: false, relationship: ['DIM5'], values: [{ id: 'v' }] },
26
29
  ];
27
30
 
28
31
  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'] },
32
+ { id: 'COMB1', concepts: ['DIM1', 'DIM2'], header: true, display: true },
33
+ { id: 'COMB2', concepts: ['DIM3', 'DIM4'], series: true, relationship: ['DIM3', 'DIM4'], display: true },
34
+ { id: 'COMB3', concepts: ['ATTR1', 'ATTR2'], header: true, display: true },
35
+ { id: 'COMB4', concepts: ['ATTR3', 'ATTR4'], series: true, relationship: ['DIM3', 'DIM4'], display: true },
36
+ { id: 'COMB5', concepts: ['DIM1', 'ATTR4'], series: true, relationship: ['DIM3', 'DIM4'], display: true },
37
+ { id: 'COMB6', concepts: ['DIM5', 'ATTR5'], series: true, relationship: ['DIM5'], display: false }
34
38
  ]);
35
39
  });
36
40
  });