test(core): Unskip and fix workflow runner test (#16227)

This commit is contained in:
Iván Ovejero
2025-06-11 13:37:22 +02:00
committed by GitHub
parent 56b16b8c0f
commit 3946e5c244

View File

@@ -259,15 +259,15 @@ describe('run', () => {
}); });
}); });
// eslint-disable-next-line n8n-local-rules/no-skipped-tests describe('enqueueExecution', () => {
describe.skip('enqueueExecution', () => {
const setupQueue = jest.fn(); const setupQueue = jest.fn();
const addJob = jest.fn();
@Service() @Service()
class MockScalingService { class MockScalingService {
setupQueue = setupQueue; setupQueue = setupQueue;
addJob = jest.fn(); addJob = addJob;
} }
beforeAll(() => { beforeAll(() => {
@@ -288,9 +288,14 @@ describe.skip('enqueueExecution', () => {
workflowData: { nodes: [] }, workflowData: { nodes: [] },
executionData: undefined, executionData: undefined,
}); });
const error = new Error('stop for test purposes');
// mock a rejection to stop execution flow before we create the PCancelable promise,
// so that Jest does not move on to tear down the suite until the PCancelable settles
addJob.mockRejectedValueOnce(error);
// @ts-expect-error Private method // @ts-expect-error Private method
await runner.enqueueExecution('1', data); await expect(runner.enqueueExecution('1', data)).rejects.toThrowError(error);
expect(setupQueue).toHaveBeenCalledTimes(1); expect(setupQueue).toHaveBeenCalledTimes(1);
}); });