Skip to content

Commit

Permalink
fix: move pinning getter tests to workflows store tests
Browse files Browse the repository at this point in the history
  • Loading branch information
alexgrozav committed Jun 1, 2023
1 parent 80948a7 commit 3c2e0ff
Showing 1 changed file with 4 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { shouldReplaceInputDataWithPinData } from '../workflowHelpers';
import { createTestingPinia } from '@pinia/testing';
import { useWorkflowsStore } from '@/stores';

Expand All @@ -7,7 +6,7 @@ beforeAll(() => {
pinia = createTestingPinia();
});

describe('workflowHelpers', () => {
describe('Workflows Store', () => {
describe('shouldReplaceInputDataWithPinData', () => {
beforeEach(() => {
pinia.state.value = {
Expand All @@ -16,22 +15,17 @@ describe('workflowHelpers', () => {
});

it('should return true if no active execution is set', () => {
const result = shouldReplaceInputDataWithPinData();
expect(result).toBe(true);
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' };

const result = shouldReplaceInputDataWithPinData();
expect(result).toBe(true);
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' };

const result = shouldReplaceInputDataWithPinData();
expect(result).toBe(false);
expect(useWorkflowsStore().shouldReplaceInputDataWithPinData).toBe(false);
});
});
});

0 comments on commit 3c2e0ff

Please sign in to comment.