@@ -149,12 +149,12 @@ describe('MessagingIntegrationAlertRule', () => {
149149 />
150150 ) ;
151151 await selectEvent . openMenu ( screen . getByLabelText ( 'channel' ) ) ;
152- expect ( await screen . findByText ( '#alerts ' ) ) . toBeInTheDocument ( ) ;
153- expect ( screen . getByText ( '#general ' ) ) . toBeInTheDocument ( ) ;
154- await selectEvent . select ( screen . getByLabelText ( 'channel' ) , ' #alerts' ) ;
152+ expect ( await screen . findByText ( '#general (1) ' ) ) . toBeInTheDocument ( ) ;
153+ expect ( screen . getByText ( '#alerts (2) ' ) ) . toBeInTheDocument ( ) ;
154+ await selectEvent . select ( screen . getByLabelText ( 'channel' ) , / # a l e r t s / ) ;
155155 expect ( mockSetChannel ) . toHaveBeenCalledWith ( {
156- label : '#alerts' ,
157- value : '#alerts ' ,
156+ label : '#alerts (2) ' ,
157+ value : '2 ' ,
158158 new : false ,
159159 } ) ;
160160 } ) ;
@@ -357,4 +357,35 @@ describe('MessagingIntegrationAlertRule', () => {
357357
358358 spy . mockRestore ( ) ;
359359 } ) ;
360+
361+ it ( 'displays and sends channel id for microsoft teams' , async ( ) => {
362+ MockApiClient . addMockResponse ( {
363+ url : `/organizations/${ organization . slug } /integrations/${ msteamsIntegrations [ 0 ] ! . id } /channels/` ,
364+ body : {
365+ nextCursor : null ,
366+ results : [
367+ { id : '1' , name : 'general' , display : '#general' , type : 'text' } ,
368+ { id : '2' , name : 'alerts' , display : '#alerts' , type : 'text' } ,
369+ ] ,
370+ } ,
371+ } ) ;
372+ render (
373+ < MessagingIntegrationAlertRule
374+ { ...{
375+ ...notificationProps ,
376+ integration : msteamsIntegrations [ 0 ] ,
377+ provider : 'msteams' ,
378+ } }
379+ />
380+ ) ;
381+ await selectEvent . openMenu ( screen . getByLabelText ( 'channel' ) ) ;
382+ expect ( await screen . findByText ( '#general (1)' ) ) . toBeInTheDocument ( ) ;
383+ expect ( screen . getByText ( '#alerts (2)' ) ) . toBeInTheDocument ( ) ;
384+ await selectEvent . select ( screen . getByLabelText ( 'channel' ) , / # a l e r t s / ) ;
385+ expect ( mockSetChannel ) . toHaveBeenCalledWith ( {
386+ label : '#alerts (2)' ,
387+ value : '2' ,
388+ new : false ,
389+ } ) ;
390+ } ) ;
360391} ) ;
0 commit comments