mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-21 11:49:59 +00:00
ci: Expand ESLint to tests in BE packages (no-changelog) (#6147)
* 🔧 Adjust base ESLint config * 🔧 Adjust `lint` and `lintfix` in `nodes-base` * 🔧 Include `test` and `utils` in `nodes-base` * 📘 Convert JS tests to TS * 👕 Apply lintfixes
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
import config from '@/config';
|
||||
|
||||
export const REST_PATH_SEGMENT = config.getEnv('endpoints.rest') as Readonly<string>;
|
||||
export const REST_PATH_SEGMENT = config.getEnv('endpoints.rest');
|
||||
|
||||
export const PUBLIC_API_REST_PATH_SEGMENT = config.getEnv('publicApi.path') as Readonly<string>;
|
||||
export const PUBLIC_API_REST_PATH_SEGMENT = config.getEnv('publicApi.path');
|
||||
|
||||
export const AUTHLESS_ENDPOINTS: Readonly<string[]> = [
|
||||
'healthz',
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
import { UserSettings } from 'n8n-core';
|
||||
import {
|
||||
DataSource as Connection,
|
||||
DataSourceOptions as ConnectionOptions,
|
||||
Repository,
|
||||
} from 'typeorm';
|
||||
import type { DataSourceOptions as ConnectionOptions, Repository } from 'typeorm';
|
||||
import { DataSource as Connection } from 'typeorm';
|
||||
import { Container } from 'typedi';
|
||||
|
||||
import config from '@/config';
|
||||
@@ -24,7 +21,7 @@ import type { TagEntity } from '@db/entities/TagEntity';
|
||||
import type { User } from '@db/entities/User';
|
||||
import type { WorkflowEntity } from '@db/entities/WorkflowEntity';
|
||||
import { RoleRepository } from '@db/repositories';
|
||||
import { ICredentialsDb } from '@/Interfaces';
|
||||
import type { ICredentialsDb } from '@/Interfaces';
|
||||
|
||||
import { DB_INITIALIZATION_TIMEOUT } from './constants';
|
||||
import { randomApiKey, randomEmail, randomName, randomString, randomValidPassword } from './random';
|
||||
@@ -211,6 +208,7 @@ export async function createManyUsers(
|
||||
amount: number,
|
||||
attributes: Partial<User> = {},
|
||||
): Promise<User[]> {
|
||||
// eslint-disable-next-line prefer-const
|
||||
let { email, password, firstName, lastName, globalRole, ...rest } = attributes;
|
||||
if (!globalRole) {
|
||||
globalRole = await getGlobalMemberRole();
|
||||
|
||||
@@ -7,25 +7,23 @@ import { CronJob } from 'cron';
|
||||
import express from 'express';
|
||||
import set from 'lodash.set';
|
||||
import { BinaryDataManager, UserSettings } from 'n8n-core';
|
||||
import {
|
||||
import type {
|
||||
ICredentialType,
|
||||
IDataObject,
|
||||
IExecuteFunctions,
|
||||
INode,
|
||||
INodeExecutionData,
|
||||
INodeParameters,
|
||||
ITriggerFunctions,
|
||||
ITriggerResponse,
|
||||
LoggerProxy,
|
||||
NodeHelpers,
|
||||
toCronExpression,
|
||||
TriggerTime,
|
||||
} from 'n8n-workflow';
|
||||
import superagent from 'superagent';
|
||||
import { deepCopy } from 'n8n-workflow';
|
||||
import { LoggerProxy, NodeHelpers, toCronExpression } from 'n8n-workflow';
|
||||
import type superagent from 'superagent';
|
||||
import request from 'supertest';
|
||||
import { URL } from 'url';
|
||||
import { mock } from 'jest-mock-extended';
|
||||
import { DeepPartial } from 'ts-essentials';
|
||||
import type { DeepPartial } from 'ts-essentials';
|
||||
import config from '@/config';
|
||||
import * as Db from '@/Db';
|
||||
import { WorkflowEntity } from '@db/entities/WorkflowEntity';
|
||||
@@ -368,7 +366,7 @@ export async function initNodeTypes() {
|
||||
outputs: ['main'],
|
||||
properties: [],
|
||||
},
|
||||
execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||
const items = this.getInputData();
|
||||
|
||||
return this.prepareOutputData(items);
|
||||
@@ -571,7 +569,7 @@ export async function initNodeTypes() {
|
||||
},
|
||||
],
|
||||
},
|
||||
execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||
const items = this.getInputData();
|
||||
|
||||
if (items.length === 0) {
|
||||
@@ -585,13 +583,13 @@ export async function initNodeTypes() {
|
||||
for (let itemIndex = 0; itemIndex < items.length; itemIndex++) {
|
||||
keepOnlySet = this.getNodeParameter('keepOnlySet', itemIndex, false) as boolean;
|
||||
item = items[itemIndex];
|
||||
const options = this.getNodeParameter('options', itemIndex, {}) as IDataObject;
|
||||
const options = this.getNodeParameter('options', itemIndex, {});
|
||||
|
||||
const newItem: INodeExecutionData = {
|
||||
json: {},
|
||||
};
|
||||
|
||||
if (keepOnlySet !== true) {
|
||||
if (!keepOnlySet) {
|
||||
if (item.binary !== undefined) {
|
||||
// Create a shallow copy of the binary data so that the old
|
||||
// data references which do not get changed still stay behind
|
||||
@@ -600,7 +598,7 @@ export async function initNodeTypes() {
|
||||
Object.assign(newItem.binary, item.binary);
|
||||
}
|
||||
|
||||
newItem.json = JSON.parse(JSON.stringify(item.json));
|
||||
newItem.json = deepCopy(item.json);
|
||||
}
|
||||
|
||||
// Add boolean values
|
||||
@@ -708,7 +706,7 @@ export function createAuthAgent(app: express.Application) {
|
||||
* Example: http://127.0.0.1:62100/me/password → http://127.0.0.1:62100/rest/me/password
|
||||
*/
|
||||
export function prefix(pathSegment: string) {
|
||||
return function (request: superagent.SuperAgentRequest) {
|
||||
return async function (request: superagent.SuperAgentRequest) {
|
||||
const url = new URL(request.url);
|
||||
|
||||
// enforce consistency at call sites
|
||||
|
||||
Reference in New Issue
Block a user