1- import { addJiraIssueComment , verifyConditions } from '../index' ;
1+ import { success , verifyConditions } from '../index' ;
22import { JiraClient } from '../jira-client' ;
33import { IssueExtractor } from '../issue-extractor' ;
44import { PluginConfig , Context } from '../types' ;
@@ -9,7 +9,7 @@ jest.mock('../issue-extractor');
99const MockedJiraClient = JiraClient as jest . MockedClass < typeof JiraClient > ;
1010const MockedIssueExtractor = IssueExtractor as jest . MockedClass < typeof IssueExtractor > ;
1111
12- describe ( 'addJiraIssueComment ' , ( ) => {
12+ describe ( 'success ' , ( ) => {
1313 let pluginConfig : PluginConfig ;
1414 let context : Context ;
1515 let mockLogger : { log : jest . Mock ; error : jest . Mock } ;
@@ -35,7 +35,7 @@ describe('addJiraIssueComment', () => {
3535 } ;
3636
3737 // Set up JIRA environment variables
38- process . env . JIRA_HOST = 'test.atlassian.net' ;
38+ process . env . JIRA_BASE_URL = 'https:// test.atlassian.net' ;
3939 process . env . JIRA_EMAIL = '[email protected] ' ; 4040 process . env . JIRA_TOKEN = 'test-token' ;
4141
@@ -55,10 +55,10 @@ describe('addJiraIssueComment', () => {
5555 MockedJiraClient . mockImplementation ( ( ) => mockJiraClient as any ) ;
5656 MockedIssueExtractor . mockImplementation ( ( ) => mockExtractor as any ) ;
5757
58- await addJiraIssueComment ( pluginConfig , context ) ;
58+ await success ( pluginConfig , context ) ;
5959
6060 expect ( MockedJiraClient ) . toHaveBeenCalledWith ( {
61- host : 'test.atlassian.net' ,
61+ baseUrl : 'https:// test.atlassian.net' ,
62626363 token : 'test-token'
6464 } ) ;
@@ -84,19 +84,19 @@ describe('addJiraIssueComment', () => {
8484
8585 pluginConfig . commentTemplate = 'Released {{version}} with tag {{gitTag}}' ;
8686
87- await addJiraIssueComment ( pluginConfig , context ) ;
87+ await success ( pluginConfig , context ) ;
8888
8989 expect ( mockJiraClient . addComment ) . toHaveBeenCalledWith ( 'ABC-123' , 'Released 1.0.0 with tag v1.0.0' ) ;
9090 } ) ;
9191
9292 it ( 'should handle missing JIRA config gracefully' , async ( ) => {
93- delete process . env . JIRA_HOST ;
93+ delete process . env . JIRA_BASE_URL ;
9494 delete process . env . JIRA_EMAIL ;
9595 delete process . env . JIRA_TOKEN ;
9696
97- await addJiraIssueComment ( pluginConfig , context ) ;
97+ await success ( pluginConfig , context ) ;
9898
99- expect ( mockLogger . error ) . toHaveBeenCalledWith ( 'JIRA configuration is missing. Please set JIRA_HOST , JIRA_EMAIL, and JIRA_TOKEN environment variables.' ) ;
99+ expect ( mockLogger . error ) . toHaveBeenCalledWith ( 'JIRA configuration is missing. Please set JIRA_BASE_URL , JIRA_EMAIL, and JIRA_TOKEN environment variables.' ) ;
100100 } ) ;
101101
102102 it ( 'should handle no issues found' , async ( ) => {
@@ -106,7 +106,7 @@ describe('addJiraIssueComment', () => {
106106
107107 MockedIssueExtractor . mockImplementation ( ( ) => mockExtractor as any ) ;
108108
109- await addJiraIssueComment ( pluginConfig , context ) ;
109+ await success ( pluginConfig , context ) ;
110110
111111 expect ( mockLogger . log ) . toHaveBeenCalledWith ( 'No JIRA issues found in commits.' ) ;
112112 } ) ;
@@ -125,7 +125,7 @@ describe('addJiraIssueComment', () => {
125125 MockedJiraClient . mockImplementation ( ( ) => mockJiraClient as any ) ;
126126 MockedIssueExtractor . mockImplementation ( ( ) => mockExtractor as any ) ;
127127
128- await addJiraIssueComment ( pluginConfig , context ) ;
128+ await success ( pluginConfig , context ) ;
129129
130130 expect ( mockJiraClient . addComment ) . toHaveBeenCalledWith ( 'ABC-123' , 'The issue (ABC-123) was included in version 1.0.0 of my-awesome-package 🎉' ) ;
131131 } ) ;
@@ -146,7 +146,7 @@ describe('addJiraIssueComment', () => {
146146
147147 pluginConfig . commentTemplate = '{{packageName}} {{version}} deployed with {{gitTag}} for {{issueKey}}' ;
148148
149- await addJiraIssueComment ( pluginConfig , context ) ;
149+ await success ( pluginConfig , context ) ;
150150
151151 expect ( mockJiraClient . addComment ) . toHaveBeenCalledWith ( 'ABC-123' , 'test-package 1.0.0 deployed with v1.0.0 for ABC-123' ) ;
152152 } ) ;
@@ -163,7 +163,7 @@ describe('addJiraIssueComment', () => {
163163 MockedJiraClient . mockImplementation ( ( ) => mockJiraClient as any ) ;
164164 MockedIssueExtractor . mockImplementation ( ( ) => mockExtractor as any ) ;
165165
166- await addJiraIssueComment ( pluginConfig , context ) ;
166+ await success ( pluginConfig , context ) ;
167167
168168 expect ( mockLogger . error ) . toHaveBeenCalledWith ( 'Failed to add comment to ABC-123: API Error' ) ;
169169 } ) ;
@@ -193,7 +193,7 @@ describe('verifyConditions', () => {
193193 } ;
194194
195195 // Set up JIRA environment variables
196- process . env . JIRA_HOST = 'test.atlassian.net' ;
196+ process . env . JIRA_BASE_URL = 'https:// test.atlassian.net' ;
197197 process . env . JIRA_EMAIL = '[email protected] ' ; 198198 process . env . JIRA_TOKEN = 'test-token' ;
199199
@@ -210,7 +210,7 @@ describe('verifyConditions', () => {
210210 await verifyConditions ( pluginConfig , context ) ;
211211
212212 expect ( MockedJiraClient ) . toHaveBeenCalledWith ( {
213- host : 'test.atlassian.net' ,
213+ baseUrl : 'https:// test.atlassian.net' ,
214214215215 token : 'test-token'
216216 } ) ;
@@ -219,11 +219,11 @@ describe('verifyConditions', () => {
219219 expect ( mockLogger . log ) . toHaveBeenCalledWith ( 'JIRA credentials verified successfully' ) ;
220220 } ) ;
221221
222- it ( 'should throw error when JIRA_HOST is missing' , async ( ) => {
223- delete process . env . JIRA_HOST ;
222+ it ( 'should throw error when JIRA_BASE_URL is missing' , async ( ) => {
223+ delete process . env . JIRA_BASE_URL ;
224224
225225 await expect ( verifyConditions ( pluginConfig , context ) )
226- . rejects . toThrow ( 'JIRA plugin configuration is invalid:\n - JIRA_HOST environment variable is required' ) ;
226+ . rejects . toThrow ( 'JIRA plugin configuration is invalid:\n - JIRA_BASE_URL environment variable is required' ) ;
227227 } ) ;
228228
229229 it ( 'should throw error when JIRA_EMAIL is missing' , async ( ) => {
@@ -241,11 +241,11 @@ describe('verifyConditions', () => {
241241 } ) ;
242242
243243 it ( 'should throw error when multiple environment variables are missing' , async ( ) => {
244- delete process . env . JIRA_HOST ;
244+ delete process . env . JIRA_BASE_URL ;
245245 delete process . env . JIRA_EMAIL ;
246246
247247 await expect ( verifyConditions ( pluginConfig , context ) )
248- . rejects . toThrow ( 'JIRA plugin configuration is invalid:\n - JIRA_HOST environment variable is required\n - JIRA_EMAIL environment variable is required' ) ;
248+ . rejects . toThrow ( 'JIRA plugin configuration is invalid:\n - JIRA_BASE_URL environment variable is required\n - JIRA_EMAIL environment variable is required' ) ;
249249 } ) ;
250250
251251 it ( 'should throw error when JIRA authentication fails' , async ( ) => {
0 commit comments