@@ -210,21 +210,30 @@ describe('ProcessInstancesService', () => {
210210 describe ( 'getExecutionHistory' , ( ) => {
211211 it ( 'should return execution history for process instance' , async ( ) => {
212212 const instanceId = MAESTRO_TEST_CONSTANTS . INSTANCE_ID ;
213+ const folderKey = MAESTRO_TEST_CONSTANTS . FOLDER_KEY ;
213214
214215 mockApiClient . get
215216 . mockResolvedValueOnce ( createMockElementExecutionsResponse ( ) )
216217 . mockResolvedValueOnce ( [ createMockTraceSpan ( ) ] ) ;
217218
218- const result = await service . getExecutionHistory ( instanceId ) ;
219+ const result = await service . getExecutionHistory ( instanceId , folderKey ) ;
219220
220221 expect ( mockApiClient . get ) . toHaveBeenCalledWith (
221222 MAESTRO_ENDPOINTS . INSTANCES . GET_ELEMENT_EXECUTIONS ( instanceId ) ,
222- { }
223+ {
224+ headers : expect . objectContaining ( {
225+ [ FOLDER_KEY ] : folderKey
226+ } )
227+ }
223228 ) ;
224229
225230 expect ( mockApiClient . get ) . toHaveBeenCalledWith (
226231 MAESTRO_ENDPOINTS . TRACES . GET_SPANS ( instanceId ) ,
227- { }
232+ {
233+ headers : expect . objectContaining ( {
234+ [ FOLDER_KEY ] : folderKey
235+ } )
236+ }
228237 ) ;
229238
230239 expect ( result ) . toHaveLength ( 1 ) ;
@@ -235,6 +244,7 @@ describe('ProcessInstancesService', () => {
235244
236245 it ( 'should only include spans matched to elementRuns' , async ( ) => {
237246 const instanceId = MAESTRO_TEST_CONSTANTS . INSTANCE_ID ;
247+ const folderKey = MAESTRO_TEST_CONSTANTS . FOLDER_KEY ;
238248 const unmatchedSpan = createMockTraceSpan ( {
239249 Id : 'nested-agent-span-1' ,
240250 ParentId : MAESTRO_TEST_CONSTANTS . SPAN_ID ,
@@ -246,7 +256,7 @@ describe('ProcessInstancesService', () => {
246256 . mockResolvedValueOnce ( createMockElementExecutionsResponse ( ) )
247257 . mockResolvedValueOnce ( [ createMockTraceSpan ( ) , unmatchedSpan ] ) ;
248258
249- const result = await service . getExecutionHistory ( instanceId ) ;
259+ const result = await service . getExecutionHistory ( instanceId , folderKey ) ;
250260
251261 // Only the matched elementRun span should be included
252262 expect ( result ) . toHaveLength ( 1 ) ;
@@ -257,7 +267,7 @@ describe('ProcessInstancesService', () => {
257267 const error = new Error ( TEST_CONSTANTS . ERROR_MESSAGE ) ;
258268 mockApiClient . get . mockRejectedValue ( error ) ;
259269
260- await expect ( service . getExecutionHistory ( MAESTRO_TEST_CONSTANTS . INSTANCE_ID ) ) . rejects . toThrow ( TEST_CONSTANTS . ERROR_MESSAGE ) ;
270+ await expect ( service . getExecutionHistory ( MAESTRO_TEST_CONSTANTS . INSTANCE_ID , MAESTRO_TEST_CONSTANTS . FOLDER_KEY ) ) . rejects . toThrow ( TEST_CONSTANTS . ERROR_MESSAGE ) ;
261271 } ) ;
262272 } ) ;
263273
0 commit comments