mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 10:02:05 +00:00
feat: Modernize build and testing for workflow package (no-changelog) (#16771)
This commit is contained in:
@@ -1,10 +1,7 @@
|
||||
/**
|
||||
* @jest-environment jsdom
|
||||
*/
|
||||
|
||||
import { arrayExtensions } from '@/extensions/array-extensions';
|
||||
// @vitest-environment jsdom
|
||||
|
||||
import { evaluate } from './helpers';
|
||||
import { arrayExtensions } from '../../src/extensions/array-extensions';
|
||||
|
||||
describe('Data Transformation Functions', () => {
|
||||
describe('Array Data Transformation Functions', () => {
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
/**
|
||||
* @jest-environment jsdom
|
||||
*/
|
||||
|
||||
import { booleanExtensions } from '@/extensions/boolean-extensions';
|
||||
// @vitest-environment jsdom
|
||||
|
||||
import { evaluate } from './helpers';
|
||||
import { booleanExtensions } from '../../src/extensions/boolean-extensions';
|
||||
|
||||
describe('Data Transformation Functions', () => {
|
||||
describe('Boolean Data Transformation Functions', () => {
|
||||
|
||||
@@ -1,13 +1,10 @@
|
||||
/**
|
||||
* @jest-environment jsdom
|
||||
*/
|
||||
// @vitest-environment jsdom
|
||||
|
||||
import { DateTime } from 'luxon';
|
||||
|
||||
import { dateExtensions } from '@/extensions/date-extensions';
|
||||
import { getGlobalState } from '@/global-state';
|
||||
|
||||
import { evaluate, getLocalISOString } from './helpers';
|
||||
import { dateExtensions } from '../../src/extensions/date-extensions';
|
||||
import { getGlobalState } from '../../src/global-state';
|
||||
|
||||
const { defaultTimezone } = getGlobalState();
|
||||
|
||||
|
||||
@@ -1,14 +1,11 @@
|
||||
/**
|
||||
* @jest-environment jsdom
|
||||
*/
|
||||
// @vitest-environment jsdom
|
||||
|
||||
/* eslint-disable n8n-local-rules/no-interpolation-in-regular-string */
|
||||
|
||||
import { ExpressionExtensionError } from '@/errors/expression-extension.error';
|
||||
import { extendTransform, extend } from '@/extensions';
|
||||
import { joinExpression, splitExpression } from '@/extensions/expression-parser';
|
||||
|
||||
import { evaluate } from './helpers';
|
||||
import { ExpressionExtensionError } from '../../src/errors/expression-extension.error';
|
||||
import { extendTransform, extend } from '../../src/extensions';
|
||||
import { joinExpression, splitExpression } from '../../src/extensions/expression-parser';
|
||||
|
||||
describe('Expression Extension Transforms', () => {
|
||||
describe('extend() transform', () => {
|
||||
@@ -210,7 +207,7 @@ describe('Expression Parser', () => {
|
||||
// This will likely break when sandboxing is implemented but it works for now.
|
||||
// If you're implementing sandboxing maybe provide a way to add functions to
|
||||
// sandbox we can check instead?
|
||||
const mockCallback = jest.fn(() => false);
|
||||
const mockCallback = vi.fn(() => false);
|
||||
evaluate('={{ $if("a"==="a", true, $data.cb()) }}', [{ cb: mockCallback }]);
|
||||
expect(mockCallback.mock.calls.length).toEqual(0);
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import type { IDataObject } from '@/interfaces';
|
||||
import { Workflow } from '@/workflow';
|
||||
|
||||
import type { IDataObject } from '../../src/interfaces';
|
||||
import { Workflow } from '../../src/workflow';
|
||||
import * as Helpers from '../helpers';
|
||||
|
||||
export const nodeTypes = Helpers.NodeTypes();
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
/**
|
||||
* @jest-environment jsdom
|
||||
*/
|
||||
|
||||
import { numberExtensions } from '@/extensions/number-extensions';
|
||||
// @vitest-environment jsdom
|
||||
|
||||
import { evaluate } from './helpers';
|
||||
import { numberExtensions } from '../../src/extensions/number-extensions';
|
||||
|
||||
describe('Data Transformation Functions', () => {
|
||||
describe('Number Data Transformation Functions', () => {
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { ApplicationError } from '@/errors';
|
||||
import { objectExtensions } from '@/extensions/object-extensions';
|
||||
|
||||
import { evaluate } from './helpers';
|
||||
import { ApplicationError } from '../../src/errors';
|
||||
import { objectExtensions } from '../../src/extensions/object-extensions';
|
||||
|
||||
describe('Data Transformation Functions', () => {
|
||||
describe('Object Data Transformation Functions', () => {
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
/**
|
||||
* @jest-environment jsdom
|
||||
*/
|
||||
// @vitest-environment jsdom
|
||||
import { DateTime } from 'luxon';
|
||||
|
||||
import { ExpressionExtensionError } from '@/errors';
|
||||
|
||||
import { evaluate } from './helpers';
|
||||
import { ExpressionExtensionError } from '../../src/errors';
|
||||
|
||||
describe('Data Transformation Functions', () => {
|
||||
describe('String Data Transformation Functions', () => {
|
||||
@@ -287,9 +284,11 @@ describe('Data Transformation Functions', () => {
|
||||
expect(evaluate('={{ "1713976144063".toDateTime("ms") }}')).toBeInstanceOf(DateTime);
|
||||
expect(evaluate('={{ "31-01-2024".toDateTime("dd-MM-yyyy") }}')).toBeInstanceOf(DateTime);
|
||||
|
||||
expect(() => evaluate('={{ "hi".toDateTime() }}')).toThrowError(
|
||||
vi.useFakeTimers({ now: new Date() });
|
||||
expect(() => evaluate('={{ "hi".toDateTime() }}')).toThrow(
|
||||
new ExpressionExtensionError('cannot convert to Luxon DateTime'),
|
||||
);
|
||||
vi.useRealTimers();
|
||||
});
|
||||
|
||||
test('.extractUrlPath should work on a string', () => {
|
||||
|
||||
Reference in New Issue
Block a user