fix(core): Account for retry of execution aborted by pre-execute hook (#9474)

This commit is contained in:
Iván Ovejero
2024-05-22 15:22:07 +02:00
committed by GitHub
parent 3094f1b886
commit a217866cef
4 changed files with 43 additions and 1 deletions

View File

@@ -0,0 +1,30 @@
import type { IExecutionResponse } from '@/Interfaces';
import type { ExecutionRepository } from '@/databases/repositories/execution.repository';
import { AbortedExecutionRetryError } from '@/errors/aborted-execution-retry.error';
import { ExecutionService } from '@/executions/execution.service';
import type { ExecutionRequest } from '@/executions/execution.types';
import { mock } from 'jest-mock-extended';
describe('ExecutionService', () => {
const executionRepository = mock<ExecutionRepository>();
const executionService = new ExecutionService(
mock(),
mock(),
mock(),
executionRepository,
mock(),
mock(),
mock(),
mock(),
);
it('should error on retrying an aborted execution', async () => {
const abortedExecutionData = mock<IExecutionResponse>({ data: { executionData: undefined } });
executionRepository.findWithUnflattenedData.mockResolvedValue(abortedExecutionData);
const req = mock<ExecutionRequest.Retry>();
const retry = executionService.retry(req, []);
await expect(retry).rejects.toThrow(AbortedExecutionRetryError);
});
});