@@ -76,16 +76,19 @@ cds.env.requires.AppNames = {
7676 checkForNextChunk : false ,
7777 events : {
7878 appNamesString : {
79- appNames : [ ] ,
79+ appNames : [ "srv-backend" ] ,
8080 } ,
8181 appNamesRegex : {
82- appNames : [ "/srv-backend.*/i" ] ,
82+ appNames : [ "/^ srv-backend.*/i" ] ,
8383 } ,
8484 appNamesMixStringMatch : {
85- appNames : [ "/srv-backend.*/i" , "a-srv-backend" ] ,
85+ appNames : [ "/^ srv-backend.*/i" , "a-srv-backend" ] ,
8686 } ,
8787 appNamesMixRegexMatch : {
88- appNames : [ "/a-srv-backend.*/i" , "srv-backend" ] ,
88+ appNames : [ "/^a-srv-backend.*/i" , "srv-backend" ] ,
89+ } ,
90+ appNamesReverseMixRegexMatch : {
91+ appNames : [ "a-srv-backend" , "/^srv-backend.*/i" ] ,
8992 } ,
9093 } ,
9194 } ,
@@ -1576,6 +1579,19 @@ describe("event-queue outbox", () => {
15761579 env . vcapApplication = { } ;
15771580 } ) ;
15781581
1582+ it ( "string - match" , async ( ) => {
1583+ const service = ( await cds . connect . to ( "AppNames" ) ) . tx ( context ) ;
1584+ env . vcapApplication = { application_name : `srv-backend` } ;
1585+ const data = { to : "to" } ;
1586+ await service . send ( "appNamesString" , data ) ;
1587+ await commitAndOpenNew ( ) ;
1588+ await testHelper . selectEventQueueAndExpectOpen ( tx , { expectedLength : 1 } ) ;
1589+ await processEventQueue ( tx . context , "CAP_OUTBOX" , "AppNames.appNamesString" ) ;
1590+ await commitAndOpenNew ( ) ;
1591+ await testHelper . selectEventQueueAndExpectDone ( tx , { expectedLength : 1 } ) ;
1592+ expect ( loggerMock . callsLengths ( ) . error ) . toEqual ( 0 ) ;
1593+ } ) ;
1594+
15791595 it ( "regex - no match" , async ( ) => {
15801596 const service = ( await cds . connect . to ( "AppNames" ) ) . tx ( context ) ;
15811597 const data = { to : "to" } ;
@@ -1639,6 +1655,19 @@ describe("event-queue outbox", () => {
16391655 await testHelper . selectEventQueueAndExpectOpen ( tx , { expectedLength : 1 } ) ;
16401656 expect ( loggerMock . callsLengths ( ) . error ) . toEqual ( 0 ) ;
16411657 } ) ;
1658+
1659+ it ( "mix - string no match - regex match" , async ( ) => {
1660+ const service = ( await cds . connect . to ( "AppNames" ) ) . tx ( context ) ;
1661+ env . vcapApplication = { application_name : `srv-backend` } ;
1662+ const data = { to : "to" } ;
1663+ await service . send ( "appNamesReverseMixRegexMatch" , data ) ;
1664+ await commitAndOpenNew ( ) ;
1665+ await testHelper . selectEventQueueAndExpectOpen ( tx , { expectedLength : 1 } ) ;
1666+ await processEventQueue ( tx . context , "CAP_OUTBOX" , "AppNames.appNamesReverseMixRegexMatch" ) ;
1667+ await commitAndOpenNew ( ) ;
1668+ await testHelper . selectEventQueueAndExpectDone ( tx , { expectedLength : 1 } ) ;
1669+ expect ( loggerMock . callsLengths ( ) . error ) . toEqual ( 0 ) ;
1670+ } ) ;
16421671 } ) ;
16431672
16441673 describe ( "redisPubSub" , ( ) => {
0 commit comments