refactor: Async functions don't need to explicitly return promises (no-changelog) (#6041)

This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™
2023-04-24 11:17:08 +00:00
committed by GitHub
parent 03be725cef
commit 308a94311f
31 changed files with 148 additions and 209 deletions

View File

@@ -99,12 +99,11 @@ jest.mock('@/Db', () => {
return {
collections: {
Workflow: {
find: jest.fn(async () => Promise.resolve(generateWorkflows(databaseActiveWorkflowsCount))),
find: jest.fn(async () => generateWorkflows(databaseActiveWorkflowsCount)),
findOne: jest.fn(async (searchParams) => {
const foundWorkflow = databaseActiveWorkflowsList.find(
return databaseActiveWorkflowsList.find(
(workflow) => workflow.id.toString() === searchParams.where.id.toString(),
);
return Promise.resolve(foundWorkflow);
}),
update: jest.fn(),
createQueryBuilder: jest.fn(() => {
@@ -112,7 +111,7 @@ jest.mock('@/Db', () => {
update: () => fakeQueryBuilder,
set: () => fakeQueryBuilder,
where: () => fakeQueryBuilder,
execute: () => Promise.resolve(),
execute: async () => {},
};
return fakeQueryBuilder;
}),
@@ -246,7 +245,7 @@ describe('ActiveWorkflowRunner', () => {
const workflow = generateWorkflows(1);
const additionalData = await WorkflowExecuteAdditionalData.getBase('fake-user-id');
workflowRunnerRun.mockImplementationOnce(() => Promise.resolve('invalid-execution-id'));
workflowRunnerRun.mockResolvedValueOnce('invalid-execution-id');
await activeWorkflowRunner.runWorkflow(
workflow[0],