File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -67,6 +67,10 @@ function getJiraBranchIdMismatchDiagnostic(
6767 }
6868
6969 const branchIssueId = utils . getJiraIssueIdFromBranchName ( gitBranch ) ;
70+ if ( ! branchIssueId ) {
71+ // No issue ID in the branch name, never mind
72+ return [ ] ;
73+ }
7074 if ( docIssueId . id . toUpperCase ( ) === branchIssueId ) {
7175 // Text and branch match, done!
7276 return [ ] ;
Original file line number Diff line number Diff line change @@ -62,6 +62,16 @@ suite("JIRA Prefix Warnings", () => {
6262 [ expected ]
6363 ) ;
6464 } ) ;
65+
66+ test ( "JIRA-123: No branch issue ID" , ( ) => {
67+ assert . deepStrictEqual (
68+ jira . _private . getJiraBranchIdMismatchDiagnostic (
69+ "holly-molly-polly" ,
70+ "JIRA-123: No branch issue ID"
71+ ) ,
72+ [ ]
73+ ) ;
74+ } ) ;
6575} ) ;
6676
6777suite ( "Quick Fix" , ( ) => {
@@ -141,6 +151,17 @@ suite("Quick Fix", () => {
141151 ] ) ;
142152 } ) ;
143153
154+ test ( "[JIRA-123] No branch issue ID" , async ( ) => {
155+ const doc = await createTextDocument ( [ "[JIRA-123] No branch issue ID" ] ) ;
156+ const actual = jira . _private . createBranchIssueIdFix (
157+ "tom-dick-and-harry" ,
158+ doc ,
159+ utils . createRange ( 0 , 5 , 5 )
160+ ) ;
161+
162+ assert . deepEqual ( actual , [ ] ) ;
163+ } ) ;
164+
144165 test ( "[JIRA-234] Already matching the branch issue ID" , async ( ) => {
145166 const doc = await createTextDocument ( [
146167 "[JIRA-234] Should match branch issue ID" ,
You can’t perform that action at this time.
0 commit comments