@@ -76,16 +76,19 @@ cds.env.requires.AppNames = {
76
76
checkForNextChunk : false ,
77
77
events : {
78
78
appNamesString : {
79
- appNames : [ ] ,
79
+ appNames : [ "srv-backend" ] ,
80
80
} ,
81
81
appNamesRegex : {
82
- appNames : [ "/srv-backend.*/i" ] ,
82
+ appNames : [ "/^ srv-backend.*/i" ] ,
83
83
} ,
84
84
appNamesMixStringMatch : {
85
- appNames : [ "/srv-backend.*/i" , "a-srv-backend" ] ,
85
+ appNames : [ "/^ srv-backend.*/i" , "a-srv-backend" ] ,
86
86
} ,
87
87
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" ] ,
89
92
} ,
90
93
} ,
91
94
} ,
@@ -1576,6 +1579,19 @@ describe("event-queue outbox", () => {
1576
1579
env . vcapApplication = { } ;
1577
1580
} ) ;
1578
1581
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
+
1579
1595
it ( "regex - no match" , async ( ) => {
1580
1596
const service = ( await cds . connect . to ( "AppNames" ) ) . tx ( context ) ;
1581
1597
const data = { to : "to" } ;
@@ -1639,6 +1655,19 @@ describe("event-queue outbox", () => {
1639
1655
await testHelper . selectEventQueueAndExpectOpen ( tx , { expectedLength : 1 } ) ;
1640
1656
expect ( loggerMock . callsLengths ( ) . error ) . toEqual ( 0 ) ;
1641
1657
} ) ;
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
+ } ) ;
1642
1671
} ) ;
1643
1672
1644
1673
describe ( "redisPubSub" , ( ) => {
0 commit comments