@@ -251,6 +251,66 @@ describe('HTTP', () => {
251251
252252 expect ( spy ) . toHaveBeenCalledWith ( jsonApiError , 422 , 'initReport' ) ;
253253 } ) ;
254+
255+ it ( 'should include tags in workflowData when provided' , async ( ) => {
256+ const makeRequestSpy = jest
257+ . spyOn ( needle , 'makeRequest' )
258+ . mockResolvedValue ( { success : true , body : { reportId : 'test-report-id' } } ) ;
259+
260+ const tags = [
261+ { key : 'env' , value : 'prod' } ,
262+ { key : 'team' , value : 'security' } ,
263+ ] ;
264+
265+ const optionsWithTags = {
266+ ...options ,
267+ report : {
268+ enabled : true ,
269+ projectName : 'test-project' ,
270+ tags,
271+ } ,
272+ } ;
273+
274+ await initReport ( optionsWithTags ) ;
275+
276+ expect ( makeRequestSpy ) . toHaveBeenCalledWith (
277+ expect . objectContaining ( {
278+ body : expect . objectContaining ( {
279+ workflowData : expect . objectContaining ( {
280+ projectName : 'test-project' ,
281+ tags,
282+ } ) ,
283+ } ) ,
284+ } ) ,
285+ ) ;
286+ } ) ;
287+
288+ it ( 'should include undefined tags in workflowData when not provided' , async ( ) => {
289+ const makeRequestSpy = jest
290+ . spyOn ( needle , 'makeRequest' )
291+ . mockResolvedValue ( { success : true , body : { reportId : 'test-report-id' } } ) ;
292+
293+ const optionsWithoutTags = {
294+ ...options ,
295+ report : {
296+ enabled : true ,
297+ projectName : 'test-project' ,
298+ } ,
299+ } ;
300+
301+ await initReport ( optionsWithoutTags ) ;
302+
303+ expect ( makeRequestSpy ) . toHaveBeenCalledWith (
304+ expect . objectContaining ( {
305+ body : expect . objectContaining ( {
306+ workflowData : expect . objectContaining ( {
307+ projectName : 'test-project' ,
308+ tags : undefined ,
309+ } ) ,
310+ } ) ,
311+ } ) ,
312+ ) ;
313+ } ) ;
254314 } ) ;
255315
256316 describe ( 'getReport' , ( ) => {
0 commit comments