mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 02:21:13 +00:00
feat: Update Workflow class usage on the Frontend for better performance (no-changelog) (#17680)
This commit is contained in:
@@ -14,14 +14,10 @@ import {
|
||||
TEST_ISSUE,
|
||||
} from './ParameterInputList.test.constants';
|
||||
import { FORM_NODE_TYPE, FORM_TRIGGER_NODE_TYPE } from 'n8n-workflow';
|
||||
import type { Workflow } from 'n8n-workflow';
|
||||
import type { INodeUi } from '../Interface';
|
||||
import type { MockInstance } from 'vitest';
|
||||
|
||||
vi.mock('@/composables/useWorkflowHelpers', () => ({
|
||||
useWorkflowHelpers: vi.fn().mockReturnValue({
|
||||
getCurrentWorkflow: vi.fn(),
|
||||
}),
|
||||
}));
|
||||
import { useWorkflowsStore } from '@/stores/workflows.store';
|
||||
|
||||
vi.mock('vue-router', async () => {
|
||||
const actual = await vi.importActual('vue-router');
|
||||
@@ -40,6 +36,7 @@ vi.mock('vue-router', async () => {
|
||||
});
|
||||
|
||||
let ndvStore: ReturnType<typeof mockedStore<typeof useNDVStore>>;
|
||||
let workflowStore: ReturnType<typeof mockedStore<typeof useWorkflowsStore>>;
|
||||
|
||||
const renderComponent = createComponentRenderer(ParameterInputList, {
|
||||
props: {
|
||||
@@ -59,6 +56,7 @@ describe('ParameterInputList', () => {
|
||||
beforeEach(() => {
|
||||
createTestingPinia();
|
||||
ndvStore = mockedStore(useNDVStore);
|
||||
workflowStore = mockedStore(useWorkflowsStore);
|
||||
});
|
||||
|
||||
it('renders', () => {
|
||||
@@ -179,20 +177,15 @@ describe('ParameterInputList', () => {
|
||||
|
||||
it('should not show triggerNotice if Form Trigger is connected', () => {
|
||||
ndvStore.activeNode = { name: 'From', type: FORM_NODE_TYPE, parameters: {} } as INodeUi;
|
||||
|
||||
workflowHelpersMock.mockReturnValue({
|
||||
getCurrentWorkflow: vi.fn(() => {
|
||||
return {
|
||||
getParentNodes: vi.fn(() => ['Form Trigger']),
|
||||
nodes: {
|
||||
'Form Trigger': {
|
||||
type: FORM_TRIGGER_NODE_TYPE,
|
||||
parameters: {},
|
||||
},
|
||||
},
|
||||
};
|
||||
}),
|
||||
});
|
||||
workflowStore.workflowObject = {
|
||||
getParentNodes: vi.fn(() => ['Form Trigger']),
|
||||
nodes: {
|
||||
'Form Trigger': {
|
||||
type: FORM_TRIGGER_NODE_TYPE,
|
||||
parameters: {},
|
||||
},
|
||||
},
|
||||
} as unknown as Workflow;
|
||||
|
||||
const { queryByText } = renderComponent({
|
||||
props: {
|
||||
|
||||
Reference in New Issue
Block a user