@@ -138,6 +138,62 @@ describe("sdk-breaking-change-labels", () => {
138
138
issueNumber : 123 ,
139
139
} ) ;
140
140
} ) ;
141
+ it ( "should correctly set labelAction to none when label name is empty" , async ( ) => {
142
+ // Setup inputs
143
+ const inputs = {
144
+ details_url : "https://dev.azure.com/project/_build/results?buildId=12345" ,
145
+ head_sha : "abc123" ,
146
+ } ;
147
+
148
+ // Setup mock for extractInputs
149
+ const { extractInputs } = await import ( "../src/context.js" ) ;
150
+ extractInputs . mockResolvedValue ( inputs ) ;
151
+
152
+ // Mock artifact responses with 'remove' action
153
+ const mockArtifactResponse = {
154
+ ok : true ,
155
+ json : vi . fn ( ) . mockResolvedValue ( {
156
+ resource : {
157
+ downloadUrl : "https://dev.azure.com/download?format=zip" ,
158
+ } ,
159
+ } ) ,
160
+ } ;
161
+
162
+ const language = "azure-sdk-for-java" ;
163
+ const mockContentResponse = {
164
+ ok : true ,
165
+ text : vi . fn ( ) . mockResolvedValue (
166
+ JSON . stringify ( {
167
+ labelAction : false ,
168
+ language,
169
+ prNumber : "123" ,
170
+ } ) ,
171
+ ) ,
172
+ } ;
173
+
174
+ // Setup fetch to return different responses for each call
175
+ global . fetch . mockImplementation ( ( url ) => {
176
+ if ( url . includes ( "artifacts?artifactName=" ) ) {
177
+ return mockArtifactResponse ;
178
+ } else {
179
+ return mockContentResponse ;
180
+ }
181
+ } ) ;
182
+
183
+ // Call function
184
+ const result = await getLabelAndAction ( {
185
+ github : mockGithub ,
186
+ context : mockContext ,
187
+ core : mockCore ,
188
+ } ) ;
189
+
190
+ // Verify result has none action
191
+ expect ( result ) . toEqual ( {
192
+ labelName : sdkLabels [ language ] . breakingChange ,
193
+ labelAction : LabelAction . None ,
194
+ issueNumber : 123 ,
195
+ } ) ;
196
+ } ) ;
141
197
it ( "should throw error with invalid inputs" , async ( ) => {
142
198
// Setup inputs
143
199
const inputs = {
0 commit comments