@@ -69,6 +69,15 @@ describe('PullRequestTitle', () => {
6969 expect ( pullRequestTitle ?. getVersion ( ) ?. toString ( ) ) . to . eql ( '1.2.3' ) ;
7070 } ) ;
7171
72+ it ( 'parses a target branch and component with a slash' , ( ) => {
73+ const name = 'chore(main): release some/title-test 0.0.1' ;
74+ const pullRequestTitle = PullRequestTitle . parse ( name ) ;
75+ expect ( pullRequestTitle ) . to . not . be . undefined ;
76+ expect ( pullRequestTitle ?. getTargetBranch ( ) ) . to . eql ( 'main' ) ;
77+ expect ( pullRequestTitle ?. getComponent ( ) ) . to . eql ( 'some/title-test' ) ;
78+ expect ( pullRequestTitle ?. getVersion ( ) ?. toString ( ) ) . to . eql ( '0.0.1' ) ;
79+ } ) ;
80+
7281 it ( 'fails to parse' , ( ) => {
7382 const pullRequestTitle = PullRequestTitle . parse ( 'release-foo' ) ;
7483 expect ( pullRequestTitle ) . to . be . undefined ;
@@ -124,7 +133,7 @@ describe('PullRequestTitle', () => {
124133 it ( 'return matchPattern with default Pattern' , ( ) => {
125134 const matchPattern = generateMatchPattern ( ) ;
126135 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 ] .* ) $ /
136+ / ^ c h o r e ( \( (?< branch > [ \w - . / ] + ) \) ) ? : r e l e a s e ? (?< component > [ \w - . / ] * ) ? v ? (?< version > [ 0 - 9 ] .* ) $ /
128137 ) ;
129138 } ) ;
130139 } ) ;
@@ -278,7 +287,7 @@ describe('PullRequestTitle with custom pullRequestTitlePattern', () => {
278287 'chore${scope}: 🔖 release${component} ${version}'
279288 ) ;
280289 expect ( matchPattern ) . to . eql (
281- / ^ c h o r e ( \( (?< branch > [ \w - . / ] + ) \) ) ? : 🔖 r e l e a s e ? (?< component > [ \w - . ] * ) ? v ? (?< version > [ 0 - 9 ] .* ) $ /
290+ / ^ c h o r e ( \( (?< branch > [ \w - . / ] + ) \) ) ? : 🔖 r e l e a s e ? (?< component > [ \w - . / ] * ) ? v ? (?< version > [ 0 - 9 ] .* ) $ /
282291 ) ;
283292 } ) ;
284293
0 commit comments