@@ -124,7 +124,7 @@ describe('PullRequestTitle', () => {
124124 it ( 'return matchPattern with default Pattern' , ( ) => {
125125 const matchPattern = generateMatchPattern ( ) ;
126126 expect ( matchPattern ) . to . eql (
127- / ^ c h o r e ( \( (?< branch > [ \w - . ] + ) \) ) ? : r e l e a s e ? (?< component > [ \w - . ] * ) ? v ? (?< version > [ 0 - 9 ] .* ) $ /
127+ / ^ c h o r e ( \( (?< branch > [ \w - . / ] + ) \) ) ? : r e l e a s e ? (?< component > [ \w - . ] * ) ? v ? (?< version > [ 0 - 9 ] .* ) $ /
128128 ) ;
129129 } ) ;
130130 } ) ;
@@ -212,6 +212,19 @@ describe('PullRequestTitle with custom pullRequestTitlePattern', () => {
212212 expect ( pullRequestTitle ?. getComponent ( ) ) . to . be . undefined ;
213213 expect ( pullRequestTitle ?. getVersion ( ) ) . to . be . undefined ;
214214 } ) ;
215+
216+ it ( 'parses a complex title and pattern' , ( ) => {
217+ const pullRequestTitle = PullRequestTitle . parse (
218+ '[HOTFIX] - chore(hotfix/v3.1.0-bug): release 3.1.0-hotfix1' ,
219+ '[HOTFIX] - chore${scope}: release${component} ${version}'
220+ ) ;
221+ expect ( pullRequestTitle ) . to . not . be . undefined ;
222+ expect ( pullRequestTitle ?. getTargetBranch ( ) ) . to . eql ( 'hotfix/v3.1.0-bug' ) ;
223+ expect ( pullRequestTitle ?. getVersion ( ) ?. toString ( ) ) . to . eql (
224+ '3.1.0-hotfix1'
225+ ) ;
226+ expect ( pullRequestTitle ?. getComponent ( ) ) . to . be . undefined ;
227+ } ) ;
215228 } ) ;
216229 describe ( 'ofVersion' , ( ) => {
217230 it ( 'builds the autorelease versioned branch name' , ( ) => {
@@ -265,7 +278,7 @@ describe('PullRequestTitle with custom pullRequestTitlePattern', () => {
265278 'chore${scope}: 🔖 release${component} ${version}'
266279 ) ;
267280 expect ( matchPattern ) . to . eql (
268- / ^ c h o r e ( \( (?< branch > [ \w - . ] + ) \) ) ? : 🔖 r e l e a s e ? (?< component > [ \w - . ] * ) ? v ? (?< version > [ 0 - 9 ] .* ) $ /
281+ / ^ c h o r e ( \( (?< branch > [ \w - . / ] + ) \) ) ? : 🔖 r e l e a s e ? (?< component > [ \w - . ] * ) ? v ? (?< version > [ 0 - 9 ] .* ) $ /
269282 ) ;
270283 } ) ;
271284
0 commit comments