martmull
2025-03-17 11:25:13 +01:00
committed by GitHub
parent e49ba69f19
commit 37599af882
2 changed files with 30 additions and 4 deletions

View File

@ -10,21 +10,46 @@ describe('getFunctionOutputSchema', () => {
e: [1, 2, 3],
};
const expectedOutputSchema = {
a: { isLeaf: true, type: 'unknown', value: null, icon: 'IconVariable' },
b: { isLeaf: true, type: 'string', value: 'b', icon: 'IconVariable' },
a: {
isLeaf: true,
type: 'unknown',
value: null,
icon: 'IconVariable',
label: 'a',
},
b: {
isLeaf: true,
type: 'string',
value: 'b',
icon: 'IconVariable',
label: 'b',
},
c: {
isLeaf: false,
icon: 'IconVariable',
value: {
cc: { isLeaf: true, type: 'number', value: 1, icon: 'IconVariable' },
cc: {
isLeaf: true,
type: 'number',
value: 1,
icon: 'IconVariable',
label: 'cc',
},
},
},
d: { isLeaf: true, type: 'boolean', value: true, icon: 'IconVariable' },
d: {
isLeaf: true,
type: 'boolean',
value: true,
icon: 'IconVariable',
label: 'd',
},
e: {
isLeaf: true,
type: 'array',
value: [1, 2, 3],
icon: 'IconVariable',
label: 'e',
},
};
expect(getFunctionOutputSchema(testResult)).toEqual(expectedOutputSchema);

View File

@ -41,6 +41,7 @@ export const getFunctionOutputSchema = (testResult: object) => {
value,
type: getValueType(value),
icon: 'IconVariable',
label: key,
};
}
return acc;