@sis-cc/dotstatsuite-components 17.12.4 → 17.12.5
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.
|
@@ -36,9 +36,10 @@ var singleValueDisplay = exports.singleValueDisplay = function singleValueDispla
|
|
|
36
36
|
var _combinedValuesDisplay = function _combinedValuesDisplay(_display) {
|
|
37
37
|
return function (values) {
|
|
38
38
|
return R.pipe(R.reduce(function (acc, val) {
|
|
39
|
-
if (
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
if (R.isNil(val)) return acc;
|
|
40
|
+
var isDisplayed = R.propOr(true, 'display', val);
|
|
41
|
+
var isRejected = R.includes(val.id, _constants.REJECTED_VALUE_IDS);
|
|
42
|
+
if ((!isDisplayed || isRejected) && _display === 'label') return acc;
|
|
42
43
|
return R.append(singleValueDisplay(_display, val), acc);
|
|
43
44
|
}, []), function (labels) {
|
|
44
45
|
if (!R.isEmpty(labels) || _display !== 'label') {
|
package/package.json
CHANGED
|
@@ -36,13 +36,10 @@ export const singleValueDisplay = (display, value) => {
|
|
|
36
36
|
const _combinedValuesDisplay = (_display) => (values) =>
|
|
37
37
|
R.pipe(
|
|
38
38
|
R.reduce((acc, val) => {
|
|
39
|
-
if (
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
) {
|
|
44
|
-
return acc;
|
|
45
|
-
}
|
|
39
|
+
if (R.isNil(val)) return acc;
|
|
40
|
+
const isDisplayed = R.propOr(true, 'display', val);
|
|
41
|
+
const isRejected = R.includes(val.id, REJECTED_VALUE_IDS);
|
|
42
|
+
if ((!isDisplayed || isRejected) && _display === 'label') return acc;
|
|
46
43
|
return R.append(singleValueDisplay(_display, val), acc);
|
|
47
44
|
}, []),
|
|
48
45
|
(labels) => {
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { expect } from 'chai';
|
|
2
|
+
import * as R from 'ramda';
|
|
3
|
+
import { combinedValuesDisplay } from '../src/rules2/src/combinedValuesDisplay';
|
|
4
|
+
|
|
5
|
+
describe('combinedValuesDisplay tests', () => {
|
|
6
|
+
const values = [
|
|
7
|
+
{
|
|
8
|
+
id: 'F3RES',
|
|
9
|
+
order: 424,
|
|
10
|
+
name: 'Debt securities issued by residents',
|
|
11
|
+
annotations: [21],
|
|
12
|
+
display: true,
|
|
13
|
+
start: null,
|
|
14
|
+
notes: [],
|
|
15
|
+
__indexPosition: 0,
|
|
16
|
+
__index: 0,
|
|
17
|
+
parents: [],
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
id: 'W',
|
|
21
|
+
order: 440,
|
|
22
|
+
name: 'World',
|
|
23
|
+
annotations: [11, 12],
|
|
24
|
+
display: false,
|
|
25
|
+
start: null,
|
|
26
|
+
notes: [],
|
|
27
|
+
__indexPosition: 0,
|
|
28
|
+
__index: 0,
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
id: 'S11',
|
|
32
|
+
order: 2,
|
|
33
|
+
name: 'Non financial corporations',
|
|
34
|
+
parent: 'S1',
|
|
35
|
+
parents: ['S1'],
|
|
36
|
+
annotations: [18, 19],
|
|
37
|
+
display: true,
|
|
38
|
+
start: null,
|
|
39
|
+
notes: [],
|
|
40
|
+
__indexPosition: 1,
|
|
41
|
+
__index: 0,
|
|
42
|
+
},
|
|
43
|
+
null,
|
|
44
|
+
];
|
|
45
|
+
|
|
46
|
+
const testdata = [
|
|
47
|
+
{
|
|
48
|
+
display: 'label',
|
|
49
|
+
expected: 'Debt securities issued by residents, Non financial corporations',
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
display: 'code',
|
|
53
|
+
expected: 'F3RES, W, S11'
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
display: 'both',
|
|
57
|
+
expected: '(F3RES, W, S11) Debt securities issued by residents, Non financial corporations',
|
|
58
|
+
}
|
|
59
|
+
];
|
|
60
|
+
|
|
61
|
+
R.forEach(({display, expected}) => {
|
|
62
|
+
it(`should pass with display ${display}`, () => {
|
|
63
|
+
expect(combinedValuesDisplay(display, values)).to.deep.equal(expected);
|
|
64
|
+
});
|
|
65
|
+
}, testdata);
|
|
66
|
+
});
|