From f56f92258341e3b5235a873d2114acdab08a48ee Mon Sep 17 00:00:00 2001 From: Marek Libra Date: Sat, 23 Nov 2024 14:14:31 +0100 Subject: [PATCH] Fix OrchestratorClient.test.ts --- .../orchestrator/src/api/OrchestratorClient.test.ts | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/plugins/orchestrator/src/api/OrchestratorClient.test.ts b/plugins/orchestrator/src/api/OrchestratorClient.test.ts index 3f2fd7af8d1..316e75cb1ee 100644 --- a/plugins/orchestrator/src/api/OrchestratorClient.test.ts +++ b/plugins/orchestrator/src/api/OrchestratorClient.test.ts @@ -98,13 +98,14 @@ describe('OrchestratorClient', () => { mockExecResponse: ExecuteWorkflowResponseDTO, executeWorkflowSpy: jest.SpyInstance, parameters: JsonObject, + businessKey?: string ) => { return () => { expect(result).toBeDefined(); expect(result.data).toEqual(mockExecResponse); expect(axios.request).toHaveBeenCalledTimes(1); expect(axios.request).toHaveBeenCalledWith({ - ...getAxiosTestRequest(`/v2/workflows/${workflowId}/execute`), + ...getAxiosTestRequest(`/v2/workflows/${workflowId}/execute${businessKey ? `?businessKey=${businessKey}`: ''}`), data: JSON.stringify({ inputData: parameters }), method: 'POST', headers: { @@ -116,6 +117,7 @@ describe('OrchestratorClient', () => { expect(executeWorkflowSpy).toHaveBeenCalledWith( workflowId, { inputData: parameters }, + businessKey, getDefaultTestRequestConfig(), ); }; @@ -138,25 +140,27 @@ describe('OrchestratorClient', () => { }); it('should execute workflow with business key', async () => { // Given + const businessKey = 'business123'; const { mockExecResponse, executeWorkflowSpy, args } = setupTest( 'execId001', {}, - 'business123', + businessKey, ); const result = await orchestratorClient.executeWorkflow(args); expect( - getExpectations(result, mockExecResponse, executeWorkflowSpy, {}), + getExpectations(result, mockExecResponse, executeWorkflowSpy, {}, businessKey), ).not.toThrow(); }); it('should execute workflow with parameters and business key', async () => { // Given + const businessKey = 'business123'; const parameters = { param1: 'one', param2: 2, param3: true }; const { mockExecResponse, executeWorkflowSpy, args } = setupTest( 'execId001', parameters, - 'business123', + businessKey ); const result = await orchestratorClient.executeWorkflow(args); @@ -167,6 +171,7 @@ describe('OrchestratorClient', () => { mockExecResponse, executeWorkflowSpy, parameters, + businessKey, ), ).not.toThrow(); });