@@ -466,6 +466,29 @@ describe('geo_containment', () => {
466466
467467 describe ( 'getGeoContainmentExecutor' , ( ) => {
468468 // Params needed for all tests
469+ const expectedAlertResults = [
470+ {
471+ actionGroupId : 'Tracked entity contained' ,
472+ context : {
473+ containingBoundaryId : 'kFATGXkBsFLYN2Tj6AAk' ,
474+ entityDocumentId : 'ZVBoGXkBsFLYN2Tj1wmV' ,
475+ entityId : '0' ,
476+ entityLocation : 'POINT (-73.99018926545978 40.751759740523994)' ,
477+ } ,
478+ instanceId : '0-kFATGXkBsFLYN2Tj6AAk' ,
479+ } ,
480+ {
481+ actionGroupId : 'Tracked entity contained' ,
482+ context : {
483+ containingBoundaryId : 'kFATGXkBsFLYN2Tj6AAk' ,
484+ entityDocumentId : 'ZlBoGXkBsFLYN2Tj1wmV' ,
485+ entityId : '1' ,
486+ entityLocation : 'POINT (-73.99561604484916 40.75449890457094)' ,
487+ } ,
488+ instanceId : '1-kFATGXkBsFLYN2Tj6AAk' ,
489+ } ,
490+ ] ;
491+ const testAlertActionArr : unknown [ ] = [ ] ;
469492 const mockLogger = loggingSystemMock . createLogger ( ) ;
470493 const previousStartedAt = new Date ( '2021-04-27T16:56:11.923Z' ) ;
471494 const startedAt = new Date ( '2021-04-29T16:56:11.923Z' ) ;
@@ -494,6 +517,8 @@ describe('geo_containment', () => {
494517 const esAggCall = jest . fn ( ) ;
495518 const alertServicesWithSearchMock : AlertServicesMock = {
496519 ...alertsMock . createAlertServices ( ) ,
520+ // @ts -ignore
521+ alertInstanceFactory : alertInstanceFactory ( expectedAlertResults , testAlertActionArr ) ,
497522 scopedClusterClient : {
498523 asCurrentUser : {
499524 // @ts -ignore
@@ -512,6 +537,7 @@ describe('geo_containment', () => {
512537
513538 beforeEach ( ( ) => {
514539 jest . clearAllMocks ( ) ;
540+ testAlertActionArr . length = 0 ;
515541 } ) ;
516542
517543 it ( 'should query for shapes if state does not contain shapes' , async ( ) => {
@@ -530,6 +556,7 @@ describe('geo_containment', () => {
530556 expect ( boundaryCall . mock . calls . length ) . toBe ( 1 ) ;
531557 expect ( esAggCall . mock . calls . length ) . toBe ( 1 ) ;
532558 }
559+ expect ( testAlertActionArr ) . toMatchObject ( expectedAlertResults ) ;
533560 } ) ;
534561
535562 it ( 'should not query for shapes if state contains shapes' , async ( ) => {
@@ -547,6 +574,7 @@ describe('geo_containment', () => {
547574 expect ( boundaryCall . mock . calls . length ) . toBe ( 0 ) ;
548575 expect ( esAggCall . mock . calls . length ) . toBe ( 1 ) ;
549576 }
577+ expect ( testAlertActionArr ) . toMatchObject ( expectedAlertResults ) ;
550578 } ) ;
551579
552580 it ( 'should carry through shapes filters in state to next call unmodified' , async ( ) => {
@@ -563,6 +591,7 @@ describe('geo_containment', () => {
563591 if ( executionResult && executionResult . shapesFilters ) {
564592 expect ( executionResult . shapesFilters ) . toEqual ( geoContainmentState . shapesFilters ) ;
565593 }
594+ expect ( testAlertActionArr ) . toMatchObject ( expectedAlertResults ) ;
566595 } ) ;
567596
568597 it ( 'should return previous locations map' , async ( ) => {
@@ -597,6 +626,7 @@ describe('geo_containment', () => {
597626 if ( executionResult && executionResult . prevLocationMap ) {
598627 expect ( executionResult . prevLocationMap ) . toEqual ( expectedPrevLocationMap ) ;
599628 }
629+ expect ( testAlertActionArr ) . toMatchObject ( expectedAlertResults ) ;
600630 } ) ;
601631 } ) ;
602632} ) ;
0 commit comments