mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-26 05:04:05 -08:00
fix: Show error when referencing node that exist but has not been executed (#6496)
Co-authored-by: कारतोफ्फेलस्क्रिप्ट™ <aditya@netroy.in>
This commit is contained in:
parent
0e071724ee
commit
3db2707b8e
|
@ -188,7 +188,11 @@ describe('Data mapping', () => {
|
||||||
ndv.getters
|
ndv.getters
|
||||||
.inlineExpressionEditorInput()
|
.inlineExpressionEditorInput()
|
||||||
.should('have.text', `{{ $('${SCHEDULE_TRIGGER_NODE_NAME}').item.json.input[0].count }}`);
|
.should('have.text', `{{ $('${SCHEDULE_TRIGGER_NODE_NAME}').item.json.input[0].count }}`);
|
||||||
ndv.getters.parameterExpressionPreview('value').should('not.exist');
|
ndv.getters
|
||||||
|
.parameterExpressionPreview('value')
|
||||||
|
.invoke('text')
|
||||||
|
.invoke('replace', /\u00a0/g, ' ')
|
||||||
|
.should('equal', '[ERROR: no data, execute "Schedule Trigger" node first]');
|
||||||
|
|
||||||
ndv.actions.switchInputMode('Table');
|
ndv.actions.switchInputMode('Table');
|
||||||
ndv.actions.mapDataFromHeader(1, 'value');
|
ndv.actions.mapDataFromHeader(1, 'value');
|
||||||
|
|
|
@ -943,6 +943,10 @@ export class WorkflowDataProxy {
|
||||||
throw createExpressionError(`"${nodeName}" node doesn't exist`);
|
throw createExpressionError(`"${nodeName}" node doesn't exist`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!that?.runExecutionData?.resultData?.runData.hasOwnProperty(nodeName)) {
|
||||||
|
throw createExpressionError(`no data, execute "${nodeName}" node first`);
|
||||||
|
}
|
||||||
|
|
||||||
return new Proxy(
|
return new Proxy(
|
||||||
{},
|
{},
|
||||||
{
|
{
|
||||||
|
|
|
@ -2,6 +2,7 @@ import type { IConnections, IExecuteData, INode, IRunExecutionData } from '@/Int
|
||||||
import { Workflow } from '@/Workflow';
|
import { Workflow } from '@/Workflow';
|
||||||
import { WorkflowDataProxy } from '@/WorkflowDataProxy';
|
import { WorkflowDataProxy } from '@/WorkflowDataProxy';
|
||||||
import * as Helpers from './Helpers';
|
import * as Helpers from './Helpers';
|
||||||
|
import { ExpressionError } from '@/ExpressionError';
|
||||||
|
|
||||||
describe('WorkflowDataProxy', () => {
|
describe('WorkflowDataProxy', () => {
|
||||||
describe('test data proxy', () => {
|
describe('test data proxy', () => {
|
||||||
|
@ -37,13 +38,21 @@ describe('WorkflowDataProxy', () => {
|
||||||
position: [460, 200],
|
position: [460, 200],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'End',
|
name: 'Set',
|
||||||
type: 'test.set',
|
type: 'test.set',
|
||||||
parameters: {},
|
parameters: {},
|
||||||
typeVersion: 1,
|
typeVersion: 1,
|
||||||
id: 'uuid-4',
|
id: 'uuid-4',
|
||||||
position: [640, 200],
|
position: [640, 200],
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: 'End',
|
||||||
|
type: 'test.set',
|
||||||
|
parameters: {},
|
||||||
|
typeVersion: 1,
|
||||||
|
id: 'uuid-5',
|
||||||
|
position: [640, 200],
|
||||||
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
const connections: IConnections = {
|
const connections: IConnections = {
|
||||||
|
@ -282,6 +291,14 @@ describe('WorkflowDataProxy', () => {
|
||||||
expect(proxy.$('Rename').params).toEqual({ value1: 'data', value2: 'initialName' });
|
expect(proxy.$('Rename').params).toEqual({ value1: 'data', value2: 'initialName' });
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('$("NodeName")', () => {
|
||||||
|
expect(() => proxy.$('doNotExist')).toThrowError(ExpressionError);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('$("NodeName")', () => {
|
||||||
|
expect(() => proxy.$('Set')).toThrowError(ExpressionError);
|
||||||
|
});
|
||||||
|
|
||||||
test('test $input.all()', () => {
|
test('test $input.all()', () => {
|
||||||
expect(proxy.$input.all()[1].json.data).toEqual(160);
|
expect(proxy.$input.all()[1].json.data).toEqual(160);
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue