test(core): Fix typing issues in tests (no-changelog) (#10244)

This commit is contained in:
Tomi Turtiainen
2024-07-30 21:24:01 +03:00
committed by GitHub
parent 5b47c8b57b
commit 3d23f2f333
18 changed files with 41 additions and 38 deletions

View File

@@ -20,7 +20,10 @@ const executionRepository = mock<ExecutionRepository>({
createNewExecution,
});
const concurrencyControl = mockInstance(ConcurrencyControlService, { isEnabled: false });
const concurrencyControl = mockInstance(ConcurrencyControlService, {
// @ts-expect-error Private property
isEnabled: false,
});
describe('ActiveExecutions', () => {
let activeExecutions: ActiveExecutions;

View File

@@ -15,11 +15,6 @@ describe('Telemetry', () => {
const spyTrack = jest.spyOn(Telemetry.prototype, 'track').mockName('track');
const mockRudderStack = mock<RudderStack>();
mockRudderStack.track.mockImplementation(function (_, cb) {
cb?.();
return this;
});
let telemetry: Telemetry;
const instanceId = 'Telemetry unit test';

View File

@@ -33,7 +33,7 @@ function setDefaultConfig() {
config.set('generic.instanceType', 'main');
}
const workerRestartEventbusResponse: RedisServiceWorkerResponseObject = {
const workerRestartEventBusResponse: RedisServiceWorkerResponseObject = {
senderId: 'test',
workerId: 'test',
command: 'restartEventBus',
@@ -88,7 +88,7 @@ describe('Orchestration Service', () => {
test('should handle worker responses', async () => {
const response = await handleWorkerResponseMessageMain(
JSON.stringify(workerRestartEventbusResponse),
JSON.stringify(workerRestartEventBusResponse),
);
expect(response.command).toEqual('restartEventBus');
});
@@ -108,7 +108,7 @@ describe('Orchestration Service', () => {
test('should reject command messages from itself', async () => {
const response = await handleCommandMessageMain(
JSON.stringify({ ...workerRestartEventbusResponse, senderId: queueModeId }),
JSON.stringify({ ...workerRestartEventBusResponse, senderId: queueModeId }),
);
expect(response).toBeDefined();
expect(response!.command).toEqual('restartEventBus');
@@ -141,7 +141,7 @@ describe('Orchestration Service', () => {
);
expect(helpers.debounceMessageReceiver).toHaveBeenCalledTimes(2);
expect(res1!.payload).toBeUndefined();
expect(res2!.payload!.result).toEqual('debounced');
expect((res2!.payload as { result: string }).result).toEqual('debounced');
});
describe('shouldAddWebhooks', () => {

View File

@@ -118,7 +118,7 @@ describe('WorkflowStatisticsService', () => {
};
const runData: IRun = {
finished: false,
status: 'failed',
status: 'error',
data: { resultData: { runData: {} } },
mode: 'internal' as WorkflowExecuteMode,
startedAt: new Date(),
@@ -206,7 +206,7 @@ describe('WorkflowStatisticsService', () => {
test('should not send metrics for entries that already have the flag set', async () => {
// Fetch data for workflow 2 which is set up to not be altered in the mocks
entityManager.insert.mockRejectedValueOnce(new QueryFailedError('', undefined, ''));
entityManager.insert.mockRejectedValueOnce(new QueryFailedError('', undefined, new Error()));
const workflowId = '1';
const node = {
id: 'abcde',