mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 18:12:04 +00:00
refactor: Delete unnecessary interface re-exports from core, and delete unused code in nodes-base (no-changelog) (#6631)
This commit is contained in:
committed by
GitHub
parent
329d22f5d1
commit
e57e85edf7
@@ -1,5 +1,7 @@
|
||||
import { get } from 'lodash';
|
||||
import { mock } from 'jest-mock-extended';
|
||||
import type { IDataObject, IExecuteFunctions, IGetNodeParameterOptions, INode } from 'n8n-workflow';
|
||||
import { constructExecutionMetaData } from 'n8n-core';
|
||||
import {
|
||||
prepareOutput,
|
||||
updateByAutoMaping,
|
||||
@@ -86,27 +88,34 @@ const responseData = {
|
||||
};
|
||||
|
||||
describe('Test MicrosoftExcelV2, prepareOutput', () => {
|
||||
const thisArg = mock<IExecuteFunctions>({
|
||||
helpers: mock({ constructExecutionMetaData }),
|
||||
});
|
||||
|
||||
it('should return empty array', () => {
|
||||
const output = prepareOutput(node, { values: [] }, { rawData: false });
|
||||
const output = prepareOutput.call(thisArg, node, { values: [] }, { rawData: false });
|
||||
expect(output).toBeDefined();
|
||||
expect(output).toEqual([]);
|
||||
});
|
||||
|
||||
it('should return raw response', () => {
|
||||
const output = prepareOutput(node, responseData, { rawData: true });
|
||||
const output = prepareOutput.call(thisArg, node, responseData, { rawData: true });
|
||||
expect(output).toBeDefined();
|
||||
expect(output[0].json.data).toEqual(responseData);
|
||||
});
|
||||
|
||||
it('should return raw response in custom property', () => {
|
||||
const customKey = 'customKey';
|
||||
const output = prepareOutput(node, responseData, { rawData: true, dataProperty: customKey });
|
||||
const output = prepareOutput.call(thisArg, node, responseData, {
|
||||
rawData: true,
|
||||
dataProperty: customKey,
|
||||
});
|
||||
expect(output).toBeDefined();
|
||||
expect(output[0].json.customKey).toEqual(responseData);
|
||||
});
|
||||
|
||||
it('should return formated response', () => {
|
||||
const output = prepareOutput(node, responseData, { rawData: false });
|
||||
const output = prepareOutput.call(thisArg, node, responseData, { rawData: false });
|
||||
expect(output).toBeDefined();
|
||||
expect(output.length).toEqual(3);
|
||||
expect(output[0].json).toEqual({
|
||||
@@ -118,7 +127,10 @@ describe('Test MicrosoftExcelV2, prepareOutput', () => {
|
||||
});
|
||||
|
||||
it('should return response with selected first data row', () => {
|
||||
const output = prepareOutput(node, responseData, { rawData: false, firstDataRow: 3 });
|
||||
const output = prepareOutput.call(thisArg, node, responseData, {
|
||||
rawData: false,
|
||||
firstDataRow: 3,
|
||||
});
|
||||
expect(output).toBeDefined();
|
||||
expect(output.length).toEqual(1);
|
||||
expect(output[0].json).toEqual({
|
||||
@@ -132,7 +144,11 @@ describe('Test MicrosoftExcelV2, prepareOutput', () => {
|
||||
it('should return response with selected first data row', () => {
|
||||
const [firstRow, ...rest] = responseData.values;
|
||||
const response = { values: [...rest, firstRow] };
|
||||
const output = prepareOutput(node, response, { rawData: false, keyRow: 3, firstDataRow: 0 });
|
||||
const output = prepareOutput.call(thisArg, node, response, {
|
||||
rawData: false,
|
||||
keyRow: 3,
|
||||
firstDataRow: 0,
|
||||
});
|
||||
expect(output).toBeDefined();
|
||||
expect(output.length).toEqual(3);
|
||||
expect(output[0].json).toEqual({
|
||||
|
||||
Reference in New Issue
Block a user