mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 02:21:13 +00:00
fix(editor): Reset lastAddedExecutingNode on execution finished event (no-changelog) (#16791)
This commit is contained in:
@@ -1,10 +1,18 @@
|
||||
import { describe, it, expect, vi } from 'vitest';
|
||||
import { mock } from 'vitest-mock-extended';
|
||||
import { continueEvaluationLoop, type SimplifiedExecution } from './executionFinished';
|
||||
import {
|
||||
continueEvaluationLoop,
|
||||
executionFinished,
|
||||
type SimplifiedExecution,
|
||||
} from './executionFinished';
|
||||
import type { ITaskData } from 'n8n-workflow';
|
||||
import { EVALUATION_TRIGGER_NODE_TYPE } from 'n8n-workflow';
|
||||
import type { INodeUi } from '@/Interface';
|
||||
import type { Router } from 'vue-router';
|
||||
import { mockedStore } from '@/__tests__/utils';
|
||||
import { useWorkflowsStore } from '@/stores/workflows.store';
|
||||
import { createTestingPinia } from '@pinia/testing';
|
||||
import { setActivePinia } from 'pinia';
|
||||
|
||||
const runWorkflow = vi.fn();
|
||||
|
||||
@@ -170,3 +178,32 @@ describe('continueEvaluationLoop()', () => {
|
||||
expect(runWorkflow).not.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
describe('executionFinished', () => {
|
||||
beforeEach(() => {
|
||||
const pinia = createTestingPinia();
|
||||
setActivePinia(pinia);
|
||||
});
|
||||
|
||||
it('should clear lastAddedExecutingNode when execution is finished', async () => {
|
||||
const workflowsStore = mockedStore(useWorkflowsStore);
|
||||
|
||||
workflowsStore.lastAddedExecutingNode = 'test-node';
|
||||
|
||||
await executionFinished(
|
||||
{
|
||||
type: 'executionFinished',
|
||||
data: {
|
||||
executionId: '1',
|
||||
workflowId: '1',
|
||||
status: 'success',
|
||||
},
|
||||
},
|
||||
{
|
||||
router: mock<Router>(),
|
||||
},
|
||||
);
|
||||
|
||||
expect(workflowsStore.lastAddedExecutingNode).toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -43,6 +43,8 @@ export async function executionFinished(
|
||||
const workflowsStore = useWorkflowsStore();
|
||||
const uiStore = useUIStore();
|
||||
|
||||
workflowsStore.lastAddedExecutingNode = null;
|
||||
|
||||
// No workflow is actively running, therefore we ignore this event
|
||||
if (typeof workflowsStore.activeExecutionId === 'undefined') {
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user