fix(Merge Node): Do not error if expected key is missing

This commit is contained in:
Michael Kret
2023-04-28 19:46:59 +03:00
committed by GitHub
parent c0b1cddc91
commit d219af75cf
11 changed files with 1257 additions and 74 deletions

View File

@@ -0,0 +1,32 @@
import type { INodeExecutionData } from 'n8n-workflow';
import { checkInput } from '../../GenericFunctions';
describe('Test Compare Datasets Node utils', () => {
it('test checkInput', () => {
const input1 = [
{ json: {} },
{
json: {
name: 'Test',
age: 30,
},
},
{
json: {
name: 'Test2',
age: 30,
},
},
];
expect(checkInput(input1).length).toEqual(2);
const input2: INodeExecutionData[] = [{ json: {} }];
expect(checkInput(input2).length).toEqual(0);
const input3 = undefined;
expect(checkInput(input3 as unknown as INodeExecutionData[]).length).toEqual(0);
});
});