mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-19 19:11:13 +00:00
fix(editor): Fix partial chat executions (#15379)
This commit is contained in:
@@ -359,6 +359,64 @@ describe('useRunWorkflow({ router })', () => {
|
||||
expect(result).toEqual(mockExecutionResponse);
|
||||
});
|
||||
|
||||
it('should exclude destinationNode from startNodes when provided', async () => {
|
||||
// ARRANGE
|
||||
const mockExecutionResponse = { executionId: '123' };
|
||||
const { runWorkflow } = useRunWorkflow({ router });
|
||||
const dataCaptor = captor<IStartRunData>();
|
||||
|
||||
const parentNodeName = 'parentNode';
|
||||
const destinationNodeName = 'destinationNode';
|
||||
|
||||
// Mock workflow with parent-child relationship
|
||||
const workflow = {
|
||||
name: 'Test Workflow',
|
||||
id: 'workflowId',
|
||||
getParentNodes: vi.fn().mockImplementation((nodeName: string) => {
|
||||
if (nodeName === destinationNodeName) {
|
||||
return [parentNodeName];
|
||||
}
|
||||
return [];
|
||||
}),
|
||||
nodes: {
|
||||
[parentNodeName]: createTestNode({ name: parentNodeName }),
|
||||
[destinationNodeName]: createTestNode({ name: destinationNodeName }),
|
||||
},
|
||||
} as unknown as Workflow;
|
||||
|
||||
vi.mocked(pushConnectionStore).isConnected = true;
|
||||
vi.mocked(workflowsStore).runWorkflow.mockResolvedValue(mockExecutionResponse);
|
||||
vi.mocked(workflowsStore).nodesIssuesExist = false;
|
||||
vi.mocked(workflowHelpers).getCurrentWorkflow.mockReturnValue(workflow);
|
||||
vi.mocked(workflowHelpers).getWorkflowDataToSave.mockResolvedValue({
|
||||
id: 'workflowId',
|
||||
nodes: [],
|
||||
} as unknown as IWorkflowData);
|
||||
|
||||
vi.mocked(workflowsStore).getWorkflowRunData = {
|
||||
[parentNodeName]: [
|
||||
{
|
||||
startTime: 1,
|
||||
executionTime: 0,
|
||||
source: [],
|
||||
data: { main: [[{ json: { test: 'data' } }]] },
|
||||
},
|
||||
],
|
||||
} as unknown as IRunData;
|
||||
|
||||
// ACT
|
||||
await runWorkflow({ destinationNode: destinationNodeName });
|
||||
|
||||
// ASSERT
|
||||
expect(workflowsStore.runWorkflow).toHaveBeenCalledTimes(1);
|
||||
expect(workflowsStore.runWorkflow).toHaveBeenCalledWith(dataCaptor);
|
||||
|
||||
const startNodes = dataCaptor.value.startNodes ?? [];
|
||||
const destinationInStartNodes = startNodes.some((node) => node.name === destinationNodeName);
|
||||
|
||||
expect(destinationInStartNodes).toBe(false);
|
||||
});
|
||||
|
||||
it('should send dirty nodes for partial executions v2', async () => {
|
||||
vi.mocked(settingsStore).partialExecutionVersion = 2;
|
||||
const composable = useRunWorkflow({ router });
|
||||
|
||||
Reference in New Issue
Block a user