fix WaitTracker tests

This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™ 2024-12-02 14:43:46 +01:00
parent d407726da4
commit 40c17af7ab
No known key found for this signature in database

View file

@ -14,7 +14,7 @@ import { WaitTracker } from '@/wait-tracker';
import type { WorkflowRunner } from '@/workflow-runner'; import type { WorkflowRunner } from '@/workflow-runner';
import { mockLogger } from '@test/mocking'; import { mockLogger } from '@test/mocking';
jest.useFakeTimers(); jest.useFakeTimers({ advanceTimers: true });
describe('WaitTracker', () => { describe('WaitTracker', () => {
const activeExecutions = mock<ActiveExecutions>(); const activeExecutions = mock<ActiveExecutions>();
@ -190,21 +190,21 @@ describe('WaitTracker', () => {
); );
postExecutePromise.resolve(mock<IRun>()); postExecutePromise.resolve(mock<IRun>());
jest.runAllTicks(); await jest.advanceTimersByTimeAsync(100);
expect(workflowRunner.run).toHaveBeenCalledTimes(2); expect(workflowRunner.run).toHaveBeenCalledTimes(2);
expect(workflowRunner.run).toHaveBeenNthCalledWith( expect(workflowRunner.run).toHaveBeenNthCalledWith(
2, 2,
{ {
executionMode: execution.mode, executionMode: parentExecution.mode,
executionData: execution.data, executionData: parentExecution.data,
workflowData: execution.workflowData, workflowData: parentExecution.workflowData,
projectId: project.id, projectId: project.id,
pushRef: execution.data.pushRef, pushRef: parentExecution.data.pushRef,
}, },
false, false,
false, false,
execution.id, parentExecution.id,
); );
}); });
}); });