fix: Show actual execution data for production executions even if pin data exists (#6302)
This commit is contained in:
31
packages/editor-ui/src/stores/__tests__/workflows.test.ts
Normal file
31
packages/editor-ui/src/stores/__tests__/workflows.test.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
import { createTestingPinia } from '@pinia/testing';
|
||||
import { useWorkflowsStore } from '@/stores';
|
||||
|
||||
let pinia: ReturnType<typeof createTestingPinia>;
|
||||
beforeAll(() => {
|
||||
pinia = createTestingPinia();
|
||||
});
|
||||
|
||||
describe('Workflows Store', () => {
|
||||
describe('shouldReplaceInputDataWithPinData', () => {
|
||||
beforeEach(() => {
|
||||
pinia.state.value = {
|
||||
workflows: useWorkflowsStore(),
|
||||
};
|
||||
});
|
||||
|
||||
it('should return true if no active execution is set', () => {
|
||||
expect(useWorkflowsStore().shouldReplaceInputDataWithPinData).toBe(true);
|
||||
});
|
||||
|
||||
it('should return true if active execution is set and mode is manual', () => {
|
||||
pinia.state.value.workflows.activeWorkflowExecution = { mode: 'manual' };
|
||||
expect(useWorkflowsStore().shouldReplaceInputDataWithPinData).toBe(true);
|
||||
});
|
||||
|
||||
it('should return false if active execution is set and mode is not manual', () => {
|
||||
pinia.state.value.workflows.activeWorkflowExecution = { mode: 'webhook' };
|
||||
expect(useWorkflowsStore().shouldReplaceInputDataWithPinData).toBe(false);
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -248,6 +248,9 @@ export const useWorkflowsStore = defineStore(STORES.WORKFLOWS, {
|
||||
return acc;
|
||||
}, 0);
|
||||
},
|
||||
shouldReplaceInputDataWithPinData(): boolean {
|
||||
return !this.activeWorkflowExecution || this.activeWorkflowExecution?.mode === 'manual';
|
||||
},
|
||||
executedNode(): string | undefined {
|
||||
return this.workflowExecutionData ? this.workflowExecutionData.executedNode : undefined;
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user