feat: Only send needed data to task runner (no-changelog) (#11487)

This commit is contained in:
Tomi Turtiainen
2024-11-04 11:13:09 +02:00
committed by GitHub
parent 2104fa1733
commit e4aa1d01f3
24 changed files with 1511 additions and 252 deletions

View File

@@ -26,6 +26,7 @@ const getProxyFromFixture = (
run: IRun | null,
activeNode: string,
mode?: WorkflowExecuteMode,
opts?: { throwOnMissingExecutionData: boolean },
) => {
const taskData = run?.data.resultData.runData[activeNode]?.[0];
const lastNodeConnectionInputData = taskData?.data?.main[0];
@@ -73,7 +74,7 @@ const getProxyFromFixture = (
executeData,
);
return dataProxy.getDataProxy();
return dataProxy.getDataProxy(opts);
};
describe('WorkflowDataProxy', () => {
@@ -404,4 +405,42 @@ describe('WorkflowDataProxy', () => {
expect(proxy.$node.PinnedSet.json.firstName).toBe('Joe');
});
});
describe('Partial data', () => {
const fixture = loadFixture('partial_data');
describe('Default behaviour (throw on missing execution data)', () => {
const proxy = getProxyFromFixture(fixture.workflow, fixture.run, 'End');
test('$binary', () => {
expect(() => proxy.$binary).toThrowError(ExpressionError);
});
test('$json', () => {
expect(() => proxy.$json).toThrowError(ExpressionError);
});
test('$data', () => {
expect(() => proxy.$data).toThrowError(ExpressionError);
});
});
describe("Don't throw on missing execution data)", () => {
const proxy = getProxyFromFixture(fixture.workflow, fixture.run, 'End', undefined, {
throwOnMissingExecutionData: false,
});
test('$binary', () => {
expect(proxy.$binary).toBeUndefined();
});
test('$json', () => {
expect(proxy.$json).toBeUndefined();
});
test('$data', () => {
expect(proxy.$data).toBeUndefined();
});
});
});
});