refactor(core): Send active workflow IDs during license renewal (#9804)

This commit is contained in:
Iván Ovejero
2024-06-19 12:35:42 +02:00
committed by GitHub
parent de3981cbde
commit cfc4db00e3
7 changed files with 83 additions and 8 deletions

View File

@@ -3,7 +3,11 @@ import Container from 'typedi';
import { WorkflowRepository } from '@/databases/repositories/workflow.repository';
import * as testDb from '../../shared/testDb';
import { createWorkflowWithTrigger, getAllWorkflows } from '../../shared/db/workflows';
import {
createWorkflowWithTrigger,
createWorkflow,
getAllWorkflows,
} from '../../shared/db/workflows';
describe('WorkflowRepository', () => {
beforeAll(async () => {
@@ -67,4 +71,27 @@ describe('WorkflowRepository', () => {
expect(after).toMatchObject([{ active: false }, { active: false }]);
});
});
describe('getActiveIds', () => {
it('should return active workflow IDs', async () => {
//
// ARRANGE
//
const workflows = await Promise.all([
createWorkflow({ active: true }),
createWorkflow({ active: false }),
createWorkflow({ active: false }),
]);
//
// ACT
//
const activeIds = await Container.get(WorkflowRepository).getActiveIds();
//
// ASSERT
//
expect(activeIds).toEqual([workflows[0].id]);
});
});
});