@sankhyalabs/core 6.1.0-dev.1 → 6.1.0-dev.2
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/dist/dataunit/formatting/PrettyFormatter.js +5 -3
- package/dist/dataunit/formatting/PrettyFormatter.js.map +1 -1
- package/package.json +1 -1
- package/reports/test-report.xml +385 -385
- package/src/dataunit/formatting/PrettyFormatter.ts +4 -5
- package/test/dataunit/formatting/PrettyFormatter.spec.ts +1 -1
|
@@ -7,7 +7,7 @@ import { FieldDescriptor, UserInterface } from '../metadata/UnitMetadata.js';
|
|
|
7
7
|
|
|
8
8
|
export const getFormattedValue = (value: any, descriptor?: FieldDescriptor) => {
|
|
9
9
|
if(descriptor?.userInterface === UserInterface.FILE){
|
|
10
|
-
return
|
|
10
|
+
return getFileFormat(value);
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
if(descriptor?.dataType === DataType.OBJECT){
|
|
@@ -131,10 +131,9 @@ const getMask = (value: string, descriptor: FieldDescriptor | undefined): string
|
|
|
131
131
|
return mask;
|
|
132
132
|
}
|
|
133
133
|
|
|
134
|
-
const
|
|
135
|
-
if (
|
|
136
|
-
|
|
134
|
+
const getFileFormat = (value: any) => {
|
|
135
|
+
if (value == undefined) return '';
|
|
136
|
+
if (!value || !Array.isArray(value)) return value;
|
|
137
137
|
if (value.length === 1) return value[0].name;
|
|
138
|
-
|
|
139
138
|
return `${value.length} arquivos`;
|
|
140
139
|
}
|
|
@@ -18,7 +18,7 @@ describe('getFormattedValue', () => {
|
|
|
18
18
|
it('should return empty string when value is not an array', () => {
|
|
19
19
|
const value = 'not an array';
|
|
20
20
|
const descriptor = getFileFieldDescriptor();
|
|
21
|
-
expect(getFormattedValue(value, descriptor)).toBe(
|
|
21
|
+
expect(getFormattedValue(value, descriptor)).toBe(value);
|
|
22
22
|
});
|
|
23
23
|
|
|
24
24
|
it('should return empty string when value is an empty array', () => {
|