Skip to content

Commit

Permalink
adding test
Browse files Browse the repository at this point in the history
  • Loading branch information
krynble committed Apr 3, 2024
1 parent 99f2cfc commit 3410270
Showing 1 changed file with 30 additions and 1 deletion.
31 changes: 30 additions & 1 deletion packages/editor-ui/src/composables/useRunWorkflow.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { useToast } from '@/composables/useToast';
import { useWorkflowHelpers } from '@/composables/useWorkflowHelpers';
import { useNodeHelpers } from '@/composables/useNodeHelpers';
import { useRouter } from 'vue-router';
import type { IPinData, IRunData, Workflow } from 'n8n-workflow';
import { ExpressionError, type IPinData, type IRunData, type Workflow } from 'n8n-workflow';

vi.mock('@/stores/n8nRoot.store', () => ({
useRootStore: vi.fn().mockReturnValue({ pushConnectionActive: true }),
Expand Down Expand Up @@ -285,5 +285,34 @@ describe('useRunWorkflow({ router })', () => {
expect(result.startNodeNames).toContain('node1');
expect(result.runData).toBeUndefined();
});

it('should rerun failed parent nodes, adding them to the returned list of start nodes and not adding their result to runData', () => {
const { consolidateRunDataAndStartNodes } = useRunWorkflow({ router });
const directParentNodes = ['node1'];
const runData = {
node1: [
{
error: new ExpressionError('error'),
},
],
} as unknown as IRunData;
const workflowMock = {
getParentNodes: vi.fn().mockReturnValue([]),
nodes: {
node1: { disabled: false },
node2: { disabled: false },
},
} as unknown as Workflow;

const result = consolidateRunDataAndStartNodes(
directParentNodes,
runData,
undefined,
workflowMock,
);

Check failure on line 312 in packages/editor-ui/src/composables/useRunWorkflow.test.ts

View workflow job for this annotation

GitHub Actions / Lint changes

Insert `;`

Check failure on line 312 in packages/editor-ui/src/composables/useRunWorkflow.test.ts

View workflow job for this annotation

GitHub Actions / Lint changes

Missing semicolon

expect(result.startNodeNames).toContain('node1');
expect(result.runData).toEqual(undefined);
})
});
});

0 comments on commit 3410270

Please sign in to comment.