mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 01:56:46 +00:00
chore: Clean up some code (#12287)
This commit is contained in:
@@ -633,6 +633,7 @@ describe('JsTaskRunner', () => {
|
|||||||
),
|
),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Assert
|
||||||
expect(rpcCallSpy).toHaveBeenCalledWith('1', group.method, group.expectedParams);
|
expect(rpcCallSpy).toHaveBeenCalledWith('1', group.method, group.expectedParams);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -661,11 +662,9 @@ describe('JsTaskRunner', () => {
|
|||||||
describe('unsupported methods', () => {
|
describe('unsupported methods', () => {
|
||||||
for (const unsupportedFunction of UNSUPPORTED_HELPER_FUNCTIONS) {
|
for (const unsupportedFunction of UNSUPPORTED_HELPER_FUNCTIONS) {
|
||||||
it(`should throw an error if ${unsupportedFunction} is used in runOnceForAllItems`, async () => {
|
it(`should throw an error if ${unsupportedFunction} is used in runOnceForAllItems`, async () => {
|
||||||
// Act
|
// Act & Assert
|
||||||
|
|
||||||
await expect(
|
await expect(
|
||||||
async () =>
|
executeForAllItems({
|
||||||
await executeForAllItems({
|
|
||||||
code: `${unsupportedFunction}()`,
|
code: `${unsupportedFunction}()`,
|
||||||
inputItems,
|
inputItems,
|
||||||
}),
|
}),
|
||||||
@@ -673,11 +672,9 @@ describe('JsTaskRunner', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it(`should throw an error if ${unsupportedFunction} is used in runOnceForEachItem`, async () => {
|
it(`should throw an error if ${unsupportedFunction} is used in runOnceForEachItem`, async () => {
|
||||||
// Act
|
// Act & Assert
|
||||||
|
|
||||||
await expect(
|
await expect(
|
||||||
async () =>
|
executeForEachItem({
|
||||||
await executeForEachItem({
|
|
||||||
code: `${unsupportedFunction}()`,
|
code: `${unsupportedFunction}()`,
|
||||||
inputItems,
|
inputItems,
|
||||||
}),
|
}),
|
||||||
|
|||||||
@@ -42,8 +42,8 @@ import { createRequireResolver } from './require-resolver';
|
|||||||
import { validateRunForAllItemsOutput, validateRunForEachItemOutput } from './result-validation';
|
import { validateRunForAllItemsOutput, validateRunForEachItemOutput } from './result-validation';
|
||||||
import { DataRequestResponseReconstruct } from '../data-request/data-request-response-reconstruct';
|
import { DataRequestResponseReconstruct } from '../data-request/data-request-response-reconstruct';
|
||||||
|
|
||||||
export interface RPCCallObject {
|
export interface RpcCallObject {
|
||||||
[name: string]: ((...args: unknown[]) => Promise<unknown>) | RPCCallObject;
|
[name: string]: ((...args: unknown[]) => Promise<unknown>) | RpcCallObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface JSExecSettings {
|
export interface JSExecSettings {
|
||||||
@@ -449,7 +449,7 @@ export class JsTaskRunner extends TaskRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private buildRpcCallObject(taskId: string) {
|
private buildRpcCallObject(taskId: string) {
|
||||||
const rpcObject: RPCCallObject = {};
|
const rpcObject: RpcCallObject = {};
|
||||||
|
|
||||||
for (const rpcMethod of EXPOSED_RPC_METHODS) {
|
for (const rpcMethod of EXPOSED_RPC_METHODS) {
|
||||||
set(
|
set(
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ const validSerializedBuffer: SerializedBuffer = {
|
|||||||
data: [65, 66, 67], // Corresponds to 'ABC' in ASCII
|
data: [65, 66, 67], // Corresponds to 'ABC' in ASCII
|
||||||
};
|
};
|
||||||
|
|
||||||
describe('serializedBufferToBuffer', () => {
|
describe('toBuffer', () => {
|
||||||
it('should convert a SerializedBuffer to a Buffer', () => {
|
it('should convert a SerializedBuffer to a Buffer', () => {
|
||||||
const buffer = toBuffer(validSerializedBuffer);
|
const buffer = toBuffer(validSerializedBuffer);
|
||||||
expect(buffer).toBeInstanceOf(Buffer);
|
expect(buffer).toBeInstanceOf(Buffer);
|
||||||
@@ -43,7 +43,7 @@ describe('isSerializedBuffer', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Integration: serializedBufferToBuffer and isSerializedBuffer', () => {
|
describe('Integration: toBuffer and isSerializedBuffer', () => {
|
||||||
it('should correctly validate and convert a SerializedBuffer', () => {
|
it('should correctly validate and convert a SerializedBuffer', () => {
|
||||||
if (isSerializedBuffer(validSerializedBuffer)) {
|
if (isSerializedBuffer(validSerializedBuffer)) {
|
||||||
const buffer = toBuffer(validSerializedBuffer);
|
const buffer = toBuffer(validSerializedBuffer);
|
||||||
|
|||||||
Reference in New Issue
Block a user