@sankhyalabs/core 5.20.0-dev.35 → 5.20.0-dev.36
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/.docs/classes/ObjectUtils.md +28 -0
- package/dist/utils/ObjectUtils.d.ts +8 -0
- package/dist/utils/ObjectUtils.js +10 -0
- package/dist/utils/ObjectUtils.js.map +1 -1
- package/package.json +1 -1
- package/reports/test-report.xml +89 -84
- package/src/utils/ObjectUtils.ts +11 -0
- package/src/utils/test/objectUtils.spec.ts +45 -0
|
@@ -76,6 +76,34 @@ src/utils/ObjectUtils.ts:84
|
|
|
76
76
|
|
|
77
77
|
***
|
|
78
78
|
|
|
79
|
+
### getProp()
|
|
80
|
+
|
|
81
|
+
> `static` **getProp**(`obj`, `keyPath`): `undefined` \| `Record`\<`string`, `any`\>
|
|
82
|
+
|
|
83
|
+
Busca a propriedade de um objeto baseado em seu caminho.
|
|
84
|
+
|
|
85
|
+
#### Parameters
|
|
86
|
+
|
|
87
|
+
• **obj**: `Record`\<`string`, `any`\>
|
|
88
|
+
|
|
89
|
+
Objeto a ser verificado.
|
|
90
|
+
|
|
91
|
+
• **keyPath**: `string`
|
|
92
|
+
|
|
93
|
+
Caminho da propriedade a ser buscada.
|
|
94
|
+
|
|
95
|
+
#### Returns
|
|
96
|
+
|
|
97
|
+
`undefined` \| `Record`\<`string`, `any`\>
|
|
98
|
+
|
|
99
|
+
- O valor da propriedade caso ela exista.
|
|
100
|
+
|
|
101
|
+
#### Source
|
|
102
|
+
|
|
103
|
+
src/utils/ObjectUtils.ts:115
|
|
104
|
+
|
|
105
|
+
***
|
|
106
|
+
|
|
79
107
|
### isEmpty()
|
|
80
108
|
|
|
81
109
|
> `static` **isEmpty**(`obj`): `boolean`
|
|
@@ -66,4 +66,12 @@ export default class ObjectUtils {
|
|
|
66
66
|
* @returns - True caso o objeto NÃO esteja vazio
|
|
67
67
|
*/
|
|
68
68
|
static isNotEmpty(obj: object): boolean;
|
|
69
|
+
/**
|
|
70
|
+
* Busca a propriedade de um objeto baseado em seu caminho.
|
|
71
|
+
*
|
|
72
|
+
* @param obj - Objeto a ser verificado.
|
|
73
|
+
* @param keyPath - Caminho da propriedade a ser buscada.
|
|
74
|
+
* @returns - O valor da propriedade caso ela exista.
|
|
75
|
+
*/
|
|
76
|
+
static getProp(obj: Record<string, any>, keyPath: string): Record<string, any> | undefined;
|
|
69
77
|
}
|
|
@@ -92,5 +92,15 @@ export default class ObjectUtils {
|
|
|
92
92
|
static isNotEmpty(obj) {
|
|
93
93
|
return !this.isEmpty(obj);
|
|
94
94
|
}
|
|
95
|
+
/**
|
|
96
|
+
* Busca a propriedade de um objeto baseado em seu caminho.
|
|
97
|
+
*
|
|
98
|
+
* @param obj - Objeto a ser verificado.
|
|
99
|
+
* @param keyPath - Caminho da propriedade a ser buscada.
|
|
100
|
+
* @returns - O valor da propriedade caso ela exista.
|
|
101
|
+
*/
|
|
102
|
+
static getProp(obj, keyPath) {
|
|
103
|
+
return keyPath.split('.').reduce((previous, current) => previous === null || previous === void 0 ? void 0 : previous[current], obj);
|
|
104
|
+
}
|
|
95
105
|
}
|
|
96
106
|
//# sourceMappingURL=ObjectUtils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ObjectUtils.js","sourceRoot":"","sources":["../../src/utils/ObjectUtils.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,WAAW;IAG5B;;;;;OAKG;IACI,MAAM,CAAC,IAAI,CAAI,IAA2B;QAC7C,OAAO,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,CAAM,CAAC;IAC/D,CAAC;IAED;;;;;;;;OAQG;IACI,MAAM,CAAC,cAAc,CAAC,IAA2B;QACpD,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;IAChC,CAAC;IAED;;;;;;;;OAQG;IACI,MAAM,CAAC,cAAc,CAAC,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;;;OAKG;IACI,MAAM,CAAC,UAAU,CAAC,GAAW;QAClC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IAC5B,CAAC;IAED;;;;;;OAMG;IACI,MAAM,CAAC,OAAO,CAAC,GAAwB,EAAE,OAAe;QAC7D,OAAO,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE,OAAO,EAAE,EAAE,CAAC,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAG,OAAO,CAAC,EAAE,GAAG,CAAC,CAAC;IACpF,CAAC;CACJ"}
|
package/package.json
CHANGED
package/reports/test-report.xml
CHANGED
|
@@ -1,149 +1,154 @@
|
|
|
1
1
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
2
|
<unitTest version="1">
|
|
3
|
-
<file path="/builds/dti/design-system/sankhyacore/test/http/HttpProvider.spec.ts">
|
|
4
|
-
<testCase name="HttpProvider Metodo GET" duration="85"/>
|
|
5
|
-
</file>
|
|
6
|
-
<file path="/builds/dti/design-system/sankhyacore/test/util/CriteriaParameter.spec.ts">
|
|
7
|
-
<testCase name="StringUtils it should return the correct values of "value" and "type" through the getters methods initial setted by the constructor" duration="81"/>
|
|
8
|
-
<testCase name="StringUtils it should return the correct values of "value" and "type" through the getters methods initial setted by the setters methods" duration="1"/>
|
|
9
|
-
<testCase name="StringUtils it should return the correct JSON/Object value through the buildParam method" duration="1"/>
|
|
10
|
-
</file>
|
|
11
3
|
<file path="/builds/dti/design-system/sankhyacore/test/http/SkwHttpProvider.ts.spec.ts">
|
|
12
|
-
<testCase name="HttpProvider Metodo POST" duration="
|
|
4
|
+
<testCase name="HttpProvider Metodo POST" duration="4"/>
|
|
5
|
+
</file>
|
|
6
|
+
<file path="/builds/dti/design-system/sankhyacore/test/http/HttpProvider.spec.ts">
|
|
7
|
+
<testCase name="HttpProvider Metodo GET" duration="92"/>
|
|
13
8
|
</file>
|
|
14
9
|
<file path="/builds/dti/design-system/sankhyacore/test/util/MaskFormatter.spec.ts">
|
|
15
|
-
<testCase name="Mask Formatter mask:CPF complete valid" duration="
|
|
10
|
+
<testCase name="Mask Formatter mask:CPF complete valid" duration="11"/>
|
|
16
11
|
<testCase name="Mask Formatter mask:CPF complete valid literals" duration="1"/>
|
|
17
12
|
<testCase name="Mask Formatter mask:CPF incomplete valid" duration="1"/>
|
|
18
13
|
<testCase name="Mask Formatter mask:CPF incomplete valid placeholder" duration="1"/>
|
|
19
|
-
<testCase name="Mask Formatter mask:CPF too long valid" duration="
|
|
20
|
-
<testCase name="Mask Formatter mask:CPF invalid for string" duration="
|
|
21
|
-
<testCase name="Mask Formatter mask:CPF invalid for being too long" duration="
|
|
14
|
+
<testCase name="Mask Formatter mask:CPF too long valid" duration="0"/>
|
|
15
|
+
<testCase name="Mask Formatter mask:CPF invalid for string" duration="383"/>
|
|
16
|
+
<testCase name="Mask Formatter mask:CPF invalid for being too long" duration="2"/>
|
|
22
17
|
<testCase name="Mask Formatter mask:Licence plate valid uppercase" duration="1"/>
|
|
23
18
|
<testCase name="Mask Formatter mask:Licence plate valid lowercase" duration="1"/>
|
|
24
|
-
<testCase name="Mask Formatter mask:Licence plate invalid" duration="
|
|
25
|
-
<testCase name="Mask Formatter mask:Licence plate invalid for being too short" duration="
|
|
26
|
-
<testCase name="Mask Formatter mask:Licence plate invalid for being too short with placeholder" duration="
|
|
27
|
-
<testCase name="Mask Formatter mask:Licence plate invalid" duration="
|
|
28
|
-
<testCase name="Mask Formatter mask:Licence plate with AlphaNumerical Mask" duration="
|
|
19
|
+
<testCase name="Mask Formatter mask:Licence plate invalid" duration="3"/>
|
|
20
|
+
<testCase name="Mask Formatter mask:Licence plate invalid for being too short" duration="1"/>
|
|
21
|
+
<testCase name="Mask Formatter mask:Licence plate invalid for being too short with placeholder" duration="1"/>
|
|
22
|
+
<testCase name="Mask Formatter mask:Licence plate invalid" duration="1"/>
|
|
23
|
+
<testCase name="Mask Formatter mask:Licence plate with AlphaNumerical Mask" duration="2"/>
|
|
29
24
|
<testCase name="Mask Formatter mask:Licence plate with AlphaNumerical Mask with placeholder" duration="1"/>
|
|
30
|
-
<testCase name="Mask Formatter mask:Licence plate invalid" duration="
|
|
31
|
-
<testCase name="Mask Formatter mask:Licence plate with AlphaNumerical Mask" duration="
|
|
25
|
+
<testCase name="Mask Formatter mask:Licence plate invalid" duration="88"/>
|
|
26
|
+
<testCase name="Mask Formatter mask:Licence plate with AlphaNumerical Mask" duration="0"/>
|
|
32
27
|
<testCase name="Mask Formatter mask:Licence plate with AlphaNumerical Mask with placeholder" duration="1"/>
|
|
33
|
-
<testCase name="Mask Formatter mask:Licence plate invalid" duration="
|
|
34
|
-
<testCase name="Mask Formatter mask:Licence plate with AlphaNumerical Mask" duration="
|
|
28
|
+
<testCase name="Mask Formatter mask:Licence plate invalid" duration="1"/>
|
|
29
|
+
<testCase name="Mask Formatter mask:Licence plate with AlphaNumerical Mask" duration="0"/>
|
|
35
30
|
<testCase name="Mask Formatter mask:Licence plate with AlphaNumerical Mask with placeholder" duration="1"/>
|
|
36
31
|
<testCase name="Mask Formatter mask:Licence plate invalid" duration="1"/>
|
|
37
32
|
</file>
|
|
33
|
+
<file path="/builds/dti/design-system/sankhyacore/test/util/CriteriaParameter.spec.ts">
|
|
34
|
+
<testCase name="StringUtils it should return the correct values of "value" and "type" through the getters methods initial setted by the constructor" duration="86"/>
|
|
35
|
+
<testCase name="StringUtils it should return the correct values of "value" and "type" through the getters methods initial setted by the setters methods" duration="4"/>
|
|
36
|
+
<testCase name="StringUtils it should return the correct JSON/Object value through the buildParam method" duration="1"/>
|
|
37
|
+
</file>
|
|
38
38
|
<file path="/builds/dti/design-system/sankhyacore/test/util/CriteriaModel.spec.ts">
|
|
39
|
-
<testCase name="StringUtils it should return the undefined and [] to Criteria Props through new class with empty constructor" duration="
|
|
40
|
-
<testCase name="StringUtils it should modify "expressions" and "parameters" properties through Setters methods" duration="
|
|
41
|
-
<testCase name="StringUtils it should return "expression" and "parameters" setted through constructor method" duration="
|
|
42
|
-
<testCase name="StringUtils it should return a Criteria class with "expression" and "parameters" as needed setted through "append" method" duration="
|
|
43
|
-
<testCase name="StringUtils it should return a Criteria class with "Criteria class" and "parameters" concatenaded as needed setted through "append" method" duration="
|
|
39
|
+
<testCase name="StringUtils it should return the undefined and [] to Criteria Props through new class with empty constructor" duration="90"/>
|
|
40
|
+
<testCase name="StringUtils it should modify "expressions" and "parameters" properties through Setters methods" duration="1"/>
|
|
41
|
+
<testCase name="StringUtils it should return "expression" and "parameters" setted through constructor method" duration="0"/>
|
|
42
|
+
<testCase name="StringUtils it should return a Criteria class with "expression" and "parameters" as needed setted through "append" method" duration="2"/>
|
|
43
|
+
<testCase name="StringUtils it should return a Criteria class with "Criteria class" and "parameters" concatenaded as needed setted through "append" method" duration="1"/>
|
|
44
44
|
<testCase name="StringUtils it should return undefined as "expression" and "[]" as parameters as we use an empty criteria as first entry in the constructor" duration="1"/>
|
|
45
45
|
<testCase name="StringUtils it should return a Criteria class with "Expression" and "parameters" concatenaded as needed setted through "OR" method" duration="1"/>
|
|
46
|
-
<testCase name="StringUtils it should return a Criteria class with "Criteria class" and "parameters" concatenaded as needed setted through "OR" method" duration="
|
|
47
|
-
<testCase name="StringUtils it should return a Criteria class with "Criteria class" and "parameters" concatenaded as needed setted through "OR" method" duration="
|
|
48
|
-
<testCase name="StringUtils it should return a Criteria class with "Expression" and "parameters" concatenaded as needed setted through "AND" method" duration="
|
|
49
|
-
<testCase name="StringUtils it should return a Criteria class with "Criteria class" and "parameters" concatenaded as needed setted through "AND" method" duration="0"/>
|
|
46
|
+
<testCase name="StringUtils it should return a Criteria class with "Criteria class" and "parameters" concatenaded as needed setted through "OR" method" duration="1"/>
|
|
47
|
+
<testCase name="StringUtils it should return a Criteria class with "Criteria class" and "parameters" concatenaded as needed setted through "OR" method" duration="1"/>
|
|
48
|
+
<testCase name="StringUtils it should return a Criteria class with "Expression" and "parameters" concatenaded as needed setted through "AND" method" duration="94"/>
|
|
50
49
|
<testCase name="StringUtils it should return a Criteria class with "Criteria class" and "parameters" concatenaded as needed setted through "AND" method" duration="1"/>
|
|
51
|
-
<testCase name="StringUtils it should return a
|
|
50
|
+
<testCase name="StringUtils it should return a Criteria class with "Criteria class" and "parameters" concatenaded as needed setted through "AND" method" duration="0"/>
|
|
51
|
+
<testCase name="StringUtils it should return a toJSON object with "Criteria class" and "parameters" concatenaded as needed setted through "AND" method" duration="1"/>
|
|
52
52
|
<testCase name="StringUtils it should return a toJSON object with through empty constructor" duration="0"/>
|
|
53
53
|
</file>
|
|
54
54
|
<file path="/builds/dti/design-system/sankhyacore/test/util/TimeFormatter.spec.ts">
|
|
55
55
|
<testCase name="TimeFormatter Case: input string unformated with showSeconds" duration="2"/>
|
|
56
|
-
<testCase name="TimeFormatter Case: input string unformated without showSeconds" duration="
|
|
56
|
+
<testCase name="TimeFormatter Case: input string unformated without showSeconds" duration="1"/>
|
|
57
57
|
<testCase name="TimeFormatter Case: validateTime" duration="1"/>
|
|
58
58
|
</file>
|
|
59
|
-
<file path="/builds/dti/design-system/sankhyacore/test/
|
|
60
|
-
<testCase name="
|
|
61
|
-
<testCase name="
|
|
62
|
-
<testCase name="
|
|
63
|
-
<testCase name="OverflowWatcher Should call callback on forceUpdate with childSpan" duration="16"/>
|
|
64
|
-
<testCase name="OverflowWatcher Should call callback on forceUpdate with childSpan when notOverFlow is empty" duration="95"/>
|
|
65
|
-
<testCase name="OverflowWatcher Should call callback on forceUpdate with childSpan considering overflowed elements" duration="16"/>
|
|
66
|
-
<testCase name="OverflowWatcher Should call callback on forceUpdate with empty list" duration="3"/>
|
|
67
|
-
<testCase name="OverflowWatcher should ignore elements that can not overflow" duration="14"/>
|
|
68
|
-
<testCase name="OverflowWatcher Should not call callback on forceUpdate" duration="1"/>
|
|
59
|
+
<file path="/builds/dti/design-system/sankhyacore/src/utils/test/objectUtils.spec.ts">
|
|
60
|
+
<testCase name="ObjectUtils should get an object value based on its path" duration="86"/>
|
|
61
|
+
<testCase name="ObjectUtils should get an object value based on its path" duration="1"/>
|
|
62
|
+
<testCase name="ObjectUtils should return undefined if the path doesn't exist in the object" duration="1"/>
|
|
69
63
|
</file>
|
|
70
64
|
<file path="/builds/dti/design-system/sankhyacore/test/util/NumberUtils.spec.ts">
|
|
71
|
-
<testCase name="StringUtils stringToNumber" duration="
|
|
72
|
-
<testCase name="StringUtils format" duration="
|
|
73
|
-
<testCase name="StringUtils format without formatnumber parameter" duration="1"/>
|
|
65
|
+
<testCase name="StringUtils stringToNumber" duration="89"/>
|
|
66
|
+
<testCase name="StringUtils format" duration="101"/>
|
|
74
67
|
<testCase name="StringUtils format without formatnumber parameter" duration="1"/>
|
|
75
|
-
<testCase name="StringUtils format
|
|
68
|
+
<testCase name="StringUtils format without formatnumber parameter" duration="103"/>
|
|
69
|
+
<testCase name="StringUtils format round number" duration="1"/>
|
|
76
70
|
</file>
|
|
77
71
|
<file path="/builds/dti/design-system/sankhyacore/test/util/StringUtils.spec.ts">
|
|
78
|
-
<testCase name="StringUtils valor vazio" duration="
|
|
72
|
+
<testCase name="StringUtils valor vazio" duration="83"/>
|
|
79
73
|
<testCase name="StringUtils valor em branco" duration="1"/>
|
|
80
74
|
<testCase name="StringUtils valor null" duration="1"/>
|
|
81
75
|
<testCase name="StringUtils valor undefined" duration="1"/>
|
|
82
|
-
<testCase name="StringUtils valor 0" duration="
|
|
76
|
+
<testCase name="StringUtils valor 0" duration="0"/>
|
|
83
77
|
<testCase name="StringUtils com valor" duration="0"/>
|
|
84
78
|
<testCase name="StringUtils substitui vogais com acento por vogais sem acento" duration="2"/>
|
|
85
79
|
<testCase name="StringUtils should return the original value when called with an object without a toString method" duration="3"/>
|
|
86
80
|
<testCase name="StringUtils should return the original value when called with undefined" duration="1"/>
|
|
87
81
|
</file>
|
|
88
|
-
<file path="/builds/dti/design-system/sankhyacore/test/util/
|
|
89
|
-
<testCase name="
|
|
90
|
-
<testCase name="
|
|
91
|
-
<testCase name="
|
|
92
|
-
<testCase name="
|
|
93
|
-
<testCase name="
|
|
94
|
-
<testCase name="
|
|
82
|
+
<file path="/builds/dti/design-system/sankhyacore/test/util/OverflowWatcher.spec.ts">
|
|
83
|
+
<testCase name="OverflowWatcher should initialize with provided parameters" duration="8"/>
|
|
84
|
+
<testCase name="OverflowWatcher should disconect ResizeObserver when destroy is called" duration="2"/>
|
|
85
|
+
<testCase name="OverflowWatcher Should call callback on forceUpdate" duration="210"/>
|
|
86
|
+
<testCase name="OverflowWatcher Should call callback on forceUpdate with childSpan" duration="93"/>
|
|
87
|
+
<testCase name="OverflowWatcher Should call callback on forceUpdate with childSpan when notOverFlow is empty" duration="97"/>
|
|
88
|
+
<testCase name="OverflowWatcher Should call callback on forceUpdate with childSpan considering overflowed elements" duration="7"/>
|
|
89
|
+
<testCase name="OverflowWatcher Should call callback on forceUpdate with empty list" duration="3"/>
|
|
90
|
+
<testCase name="OverflowWatcher should ignore elements that can not overflow" duration="97"/>
|
|
91
|
+
<testCase name="OverflowWatcher Should not call callback on forceUpdate" duration="1"/>
|
|
95
92
|
</file>
|
|
96
93
|
<file path="/builds/dti/design-system/sankhyacore/test/util/ElementIDUtils.spec.ts">
|
|
97
|
-
<testCase name="addIDInfo 1 - should add data-element-id with valid id "movFinanceira_snkApplication"" duration="
|
|
98
|
-
<testCase name="addIDInfo 2 - should add data-element-id with valid id "brComSankhyaFinCadMovimentacaofinanceira_snkApplication"" duration="
|
|
94
|
+
<testCase name="addIDInfo 1 - should add data-element-id with valid id "movFinanceira_snkApplication"" duration="9"/>
|
|
95
|
+
<testCase name="addIDInfo 2 - should add data-element-id with valid id "brComSankhyaFinCadMovimentacaofinanceira_snkApplication"" duration="1"/>
|
|
99
96
|
<testCase name="addIDInfo 3 - should add data-element-id with valid id "movFinanceira_br.com.sankhya.fin.cad.movimentacaoFinanceira"" duration="1"/>
|
|
100
|
-
<testCase name="addIDInfo 4 - should add data-element-id with valid id "meuID2_snkApplication"" duration="
|
|
101
|
-
<testCase name="addIDInfo 5 - should add data-element-id with valid id "movFinanceira_snkApplication"" duration="
|
|
102
|
-
<testCase name="addIDInfo 6 - should add data-element-id with valid id "movFinanceira_snkApplication"" duration="
|
|
97
|
+
<testCase name="addIDInfo 4 - should add data-element-id with valid id "meuID2_snkApplication"" duration="2"/>
|
|
98
|
+
<testCase name="addIDInfo 5 - should add data-element-id with valid id "movFinanceira_snkApplication"" duration="76"/>
|
|
99
|
+
<testCase name="addIDInfo 6 - should add data-element-id with valid id "movFinanceira_snkApplication"" duration="1"/>
|
|
103
100
|
<testCase name="addIDInfo 7 - should add data-element-id with valid id "componenteNameTest_snkApplication"" duration="1"/>
|
|
104
101
|
<testCase name="addIDInfo 8 - should add data-element-id with valid id "componentLabel_snkApplication"" duration="1"/>
|
|
105
|
-
<testCase name="addIDInfo 9 - should add data-element-id with valid id "dataunitFinanceiro_br.com.sankhya.fin.cad.movimentacaoFinanceira"" duration="
|
|
102
|
+
<testCase name="addIDInfo 9 - should add data-element-id with valid id "dataunitFinanceiro_br.com.sankhya.fin.cad.movimentacaoFinanceira"" duration="1"/>
|
|
106
103
|
<testCase name="addIDInfo 10 - should add data-element-id with valid id "dataunitFinanceiro_meuIDTeste_br.com.sankhya.fin.cad.movimentacaoFinanceira"" duration="1"/>
|
|
107
|
-
<testCase name="addIDInfo 11 - should add data-element-id with valid id "dataunitFinanceiro_meuIDTeste_movimentacaoFinanceira"" duration="
|
|
104
|
+
<testCase name="addIDInfo 11 - should add data-element-id with valid id "dataunitFinanceiro_meuIDTeste_movimentacaoFinanceira"" duration="1"/>
|
|
108
105
|
<testCase name="addIDInfo 12 - should add data-element-id with valid id "dataunitFinanceiro_movFinanceira_movimentacaoFinanceira"" duration="1"/>
|
|
109
|
-
<testCase name="addIDInfo 13 - should add data-element-id with valid id "dataunitFinanceiro_meuIDTeste_movimentacaoFinanceira"" duration="
|
|
110
|
-
<testCase name="addIDInfo 14 - should add data-element-id with valid id "dataunitFinanceiro_meuIdTeste_movimentacaoFinanceira"" duration="
|
|
111
|
-
<testCase name="addIDInfo 15 - should add data-element-id with valid id "dataunitFinanceiro_meuIdTeste_snkApplication"" duration="
|
|
106
|
+
<testCase name="addIDInfo 13 - should add data-element-id with valid id "dataunitFinanceiro_meuIDTeste_movimentacaoFinanceira"" duration="1"/>
|
|
107
|
+
<testCase name="addIDInfo 14 - should add data-element-id with valid id "dataunitFinanceiro_meuIdTeste_movimentacaoFinanceira"" duration="1"/>
|
|
108
|
+
<testCase name="addIDInfo 15 - should add data-element-id with valid id "dataunitFinanceiro_meuIdTeste_snkApplication"" duration="0"/>
|
|
112
109
|
<testCase name="addIDInfo 16 - should add data-element-id with valid id "dataunitFinanceiro_meuIdTeste_snkApplication"" duration="1"/>
|
|
113
110
|
<testCase name="addIDInfo 17 - should add data-element-id with valid id "movFinanceira_movimentacaoFinanceira"" duration="1"/>
|
|
114
|
-
<testCase name="addIDInfo 18 - should add data-element-id with valid id "movFinanceira_movimentacaoFinanceira"" duration="
|
|
111
|
+
<testCase name="addIDInfo 18 - should add data-element-id with valid id "movFinanceira_movimentacaoFinanceira"" duration="0"/>
|
|
115
112
|
<testCase name="addIDInfo 19 - should add data-element-id with valid id "movFinanceira_movimentacaoFinanceira"" duration="1"/>
|
|
116
|
-
<testCase name="addIDInfo 20 - should add data-element-id with valid id "movFinanceira_movimentacaoFinanceira"" duration="
|
|
117
|
-
<testCase name="addIDInfo 21 - should add data-element-id with valid id "movFinanceira_movimentacaoFinanceira"" duration="
|
|
118
|
-
<testCase name="addIDInfo 22 - should add data-element-id with valid id "bancoObrigatorio_movimentacaoFinanceira"" duration="
|
|
113
|
+
<testCase name="addIDInfo 20 - should add data-element-id with valid id "movFinanceira_movimentacaoFinanceira"" duration="1"/>
|
|
114
|
+
<testCase name="addIDInfo 21 - should add data-element-id with valid id "movFinanceira_movimentacaoFinanceira"" duration="0"/>
|
|
115
|
+
<testCase name="addIDInfo 22 - should add data-element-id with valid id "bancoObrigatorio_movimentacaoFinanceira"" duration="0"/>
|
|
116
|
+
</file>
|
|
117
|
+
<file path="/builds/dti/design-system/sankhyacore/test/util/DataUnitStorage.spec.ts">
|
|
118
|
+
<testCase name="DataUnitStorage put should store a DataUnit instance in the DataUnitStorage" duration="6"/>
|
|
119
|
+
<testCase name="DataUnitStorage get should return the stored DataUnit instance from the DataUnitStorage" duration="1"/>
|
|
120
|
+
<testCase name="DataUnitStorage get should return undefined if the DataUnit instance is not found in the DataUnitStorage" duration="1"/>
|
|
121
|
+
<testCase name="DataUnitStorage remove should remove the specified DataUnit instance from the DataUnitStorage" duration="0"/>
|
|
122
|
+
<testCase name="DataUnitStorage remove should remove the DataUnit instance with the specified name from the DataUnitStorage" duration="0"/>
|
|
123
|
+
<testCase name="DataUnitStorage remove should not remove any DataUnit instance if the specified DataUnit instance or name is not found in the DataUnitStorage" duration="1"/>
|
|
119
124
|
</file>
|
|
120
125
|
<file path="/builds/dti/design-system/sankhyacore/test/util/ElementUtils.spec.ts">
|
|
121
|
-
<testCase name="calcMarginSize should calculate correctly the size of horizontal margin" duration="
|
|
122
|
-
<testCase name="calcMarginSize should calculate correctly the size of vertical margin" duration="
|
|
123
|
-
<testCase name="calcMarginSize should threat values defined as zero" duration="
|
|
126
|
+
<testCase name="calcMarginSize should calculate correctly the size of horizontal margin" duration="26"/>
|
|
127
|
+
<testCase name="calcMarginSize should calculate correctly the size of vertical margin" duration="2"/>
|
|
128
|
+
<testCase name="calcMarginSize should threat values defined as zero" duration="3"/>
|
|
124
129
|
</file>
|
|
125
130
|
<file path="/builds/dti/design-system/sankhyacore/test/dataunit/formatting/PrettyFormatter.spec.ts">
|
|
126
|
-
<testCase name="getFormattedValue should return empty string when value is null" duration="
|
|
131
|
+
<testCase name="getFormattedValue should return empty string when value is null" duration="5"/>
|
|
127
132
|
<testCase name="getFormattedValue should return empty string when value is not an array" duration="1"/>
|
|
128
133
|
<testCase name="getFormattedValue should return empty string when value is an empty array" duration="0"/>
|
|
129
|
-
<testCase name="getFormattedValue should return file name when value is an array with one file object" duration="
|
|
134
|
+
<testCase name="getFormattedValue should return file name when value is an array with one file object" duration="4"/>
|
|
130
135
|
<testCase name="getFormattedValue should return file count when value is an array with multiple file objects" duration="0"/>
|
|
131
136
|
<testCase name="getFormattedValue should return empty string for undefined file" duration="0"/>
|
|
132
|
-
<testCase name="getFormattedValue should handle OBJECT type with value field" duration="
|
|
133
|
-
<testCase name="getFormattedValue should return empty string when value is undefined" duration="
|
|
134
|
-
<testCase name="getFormattedValue should return value as string when value is not an object" duration="
|
|
137
|
+
<testCase name="getFormattedValue should handle OBJECT type with value field" duration="0"/>
|
|
138
|
+
<testCase name="getFormattedValue should return empty string when value is undefined" duration="1"/>
|
|
139
|
+
<testCase name="getFormattedValue should return value as string when value is not an object" duration="0"/>
|
|
135
140
|
<testCase name="getFormattedValue should return value.toString() when value is an object without value property" duration="0"/>
|
|
136
141
|
<testCase name="getFormattedValue should handle BOOLEAN type" duration="0"/>
|
|
137
142
|
<testCase name="getFormattedValue should format numbers correctly" duration="10"/>
|
|
138
|
-
<testCase name="getFormattedValue should format dates correctly" duration="
|
|
139
|
-
<testCase name="getFormattedValue should format times correctly" duration="
|
|
143
|
+
<testCase name="getFormattedValue should format dates correctly" duration="4"/>
|
|
144
|
+
<testCase name="getFormattedValue should format times correctly" duration="0"/>
|
|
140
145
|
<testCase name="getFormattedValue should format datetime correctly" duration="1"/>
|
|
141
|
-
<testCase name="getFormattedValue should call toString with correct parameters" duration="
|
|
146
|
+
<testCase name="getFormattedValue should call toString with correct parameters" duration="1"/>
|
|
142
147
|
<testCase name="getFormattedValue should handle undefined descriptor gracefully" duration="0"/>
|
|
143
|
-
<testCase name="getFormattedValue should format value correctly with OPTIONSELECTOR and matching option" duration="
|
|
144
|
-
<testCase name="getFormattedValue should return value with OPTIONSELECTOR and no matching option" duration="
|
|
148
|
+
<testCase name="getFormattedValue should format value correctly with OPTIONSELECTOR and matching option" duration="0"/>
|
|
149
|
+
<testCase name="getFormattedValue should return value with OPTIONSELECTOR and no matching option" duration="1"/>
|
|
145
150
|
<testCase name="getFormattedValue should format value correctly with OPTIONSELECTOR and value as object" duration="0"/>
|
|
146
|
-
<testCase name="getFormattedValue should return empty string with OPTIONSELECTOR and value as null" duration="
|
|
151
|
+
<testCase name="getFormattedValue should return empty string with OPTIONSELECTOR and value as null" duration="0"/>
|
|
147
152
|
<testCase name="getFormattedValue should format value correctly with OPTIONSELECTOR and options as JSON string" duration="0"/>
|
|
148
153
|
<testCase name="getFormattedValue should return value with OPTIONSELECTOR and options as empty array" duration="0"/>
|
|
149
154
|
<testCase name="getFormattedValue should format masked values correctly" duration="1"/>
|
package/src/utils/ObjectUtils.ts
CHANGED
|
@@ -104,4 +104,15 @@ export default class ObjectUtils{
|
|
|
104
104
|
public static isNotEmpty(obj: object): boolean{
|
|
105
105
|
return !this.isEmpty(obj);
|
|
106
106
|
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Busca a propriedade de um objeto baseado em seu caminho.
|
|
110
|
+
*
|
|
111
|
+
* @param obj - Objeto a ser verificado.
|
|
112
|
+
* @param keyPath - Caminho da propriedade a ser buscada.
|
|
113
|
+
* @returns - O valor da propriedade caso ela exista.
|
|
114
|
+
*/
|
|
115
|
+
public static getProp(obj: Record<string, any>, keyPath: string): Record<string, any> | undefined {
|
|
116
|
+
return keyPath.split('.').reduce((previous, current) => previous?.[current], obj);
|
|
117
|
+
}
|
|
107
118
|
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import ObjectUtils from '../ObjectUtils'
|
|
2
|
+
|
|
3
|
+
describe("ObjectUtils", () => {
|
|
4
|
+
it("should get an object value based on its path", async () => {
|
|
5
|
+
const obj = {
|
|
6
|
+
food: {
|
|
7
|
+
fruits: {
|
|
8
|
+
apple: 1,
|
|
9
|
+
banana: 2
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const value = ObjectUtils.getProp(obj, "food.fruits.banana");
|
|
15
|
+
expect(value).toBe(2);
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
it("should get an object value based on its path", async () => {
|
|
19
|
+
const food = {
|
|
20
|
+
fruits: {
|
|
21
|
+
apple: 1,
|
|
22
|
+
banana: 2
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const obj = { food };
|
|
27
|
+
|
|
28
|
+
const value = ObjectUtils.getProp(obj, "food");
|
|
29
|
+
expect(JSON.stringify(value)).toBe(JSON.stringify(food));
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
it("should return undefined if the path doesn't exist in the object", async () => {
|
|
33
|
+
const obj = {
|
|
34
|
+
food: {
|
|
35
|
+
fruits: {
|
|
36
|
+
apple: 1,
|
|
37
|
+
banana: 2
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
const value = ObjectUtils.getProp(obj, "vegetables");
|
|
43
|
+
expect(value).toBe(undefined);
|
|
44
|
+
});
|
|
45
|
+
});
|