Fix output schema type not defined (#11788)
Fixes https://github.com/twentyhq/twenty/issues/11778
This commit is contained in:
@ -61,6 +61,19 @@ const mockStep = {
|
|||||||
} satisfies StepOutputSchema;
|
} satisfies StepOutputSchema;
|
||||||
|
|
||||||
describe('searchVariableThroughOutputSchema', () => {
|
describe('searchVariableThroughOutputSchema', () => {
|
||||||
|
it('should not break with wrong path', () => {
|
||||||
|
const result = searchVariableThroughOutputSchema({
|
||||||
|
stepOutputSchema: mockStep,
|
||||||
|
rawVariableName: '{{step-1.wrong.wrong.wrong}}',
|
||||||
|
isFullRecord: false,
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(result).toEqual({
|
||||||
|
variableLabel: undefined,
|
||||||
|
variablePathLabel: 'Step 1 > undefined',
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
it('should find a company field variable', () => {
|
it('should find a company field variable', () => {
|
||||||
const result = searchVariableThroughOutputSchema({
|
const result = searchVariableThroughOutputSchema({
|
||||||
stepOutputSchema: mockStep,
|
stepOutputSchema: mockStep,
|
||||||
|
|||||||
@ -47,7 +47,9 @@ const searchCurrentStepOutputSchema = ({
|
|||||||
let variablePathLabel = stepOutputSchema.name;
|
let variablePathLabel = stepOutputSchema.name;
|
||||||
|
|
||||||
while (nextKeyIndex < path.length) {
|
while (nextKeyIndex < path.length) {
|
||||||
if (isRecordOutputSchema(currentSubStep)) {
|
if (!isDefined(currentSubStep)) {
|
||||||
|
break;
|
||||||
|
} else if (isRecordOutputSchema(currentSubStep)) {
|
||||||
const currentField = currentSubStep.fields[nextKey];
|
const currentField = currentSubStep.fields[nextKey];
|
||||||
currentSubStep = currentField?.value;
|
currentSubStep = currentField?.value;
|
||||||
nextKey = path[nextKeyIndex + 1];
|
nextKey = path[nextKeyIndex + 1];
|
||||||
|
|||||||
Reference in New Issue
Block a user