@@ -241,6 +241,49 @@ describe("API testing - BitBucket Server", () => {
241241 ] )
242242 } )
243243
244+ it ( "getDangerCommentsCaseInsensitive" , async ( ) => {
245+ const commitID = "e70f3d6468f61a4bef68c9e6eaba9166b096e23c"
246+ jsonResult = ( ) => ( {
247+ isLastPage : true ,
248+ values : [
249+ {
250+ comment : {
251+ text : `FAIL! danger-id-1; ${ dangerSignaturePostfix ( { } as DangerResults , commitID ) } ` ,
252+ author : {
253+ name : "userNAME" ,
254+ } ,
255+ } ,
256+ } ,
257+ {
258+ comment : null ,
259+ } ,
260+ {
261+ comment : {
262+ text : "not a danger comment" ,
263+ author : {
264+ name : "azz" ,
265+ } ,
266+ } ,
267+ } ,
268+ ] ,
269+ } )
270+ const result = await api . getDangerComments ( "1" )
271+
272+ expect ( api . fetch ) . toHaveBeenCalledWith (
273+ `${ host } /rest/api/1.0/projects/FOO/repos/BAR/pull-requests/1/activities?fromType=COMMENT&start=0` ,
274+ { method : "GET" , body : null , headers : expectedJSONHeaders } ,
275+ undefined
276+ )
277+ expect ( result ) . toEqual ( [
278+ {
279+ text : `FAIL! danger-id-1; ${ dangerSignaturePostfix ( { } as DangerResults , commitID ) } ` ,
280+ author : {
281+ name : "userNAME" ,
282+ } ,
283+ } ,
284+ ] )
285+ } )
286+
244287 it ( "getDangerInlineComments" , async ( ) => {
245288 jsonResult = ( ) => ( {
246289 isLastPage : true ,
@@ -270,6 +313,35 @@ describe("API testing - BitBucket Server", () => {
270313 expect ( comments [ 0 ] . ownedByDanger ) . toBeTruthy ( )
271314 } )
272315
316+ it ( "getDangerInlineCommentsCaseInsensitive" , async ( ) => {
317+ jsonResult = ( ) => ( {
318+ isLastPage : true ,
319+ values : [
320+ {
321+ comment : {
322+ text :
323+ "\n[//]: # (danger-id-default;)\n[//]: # ( File: README.md;\n Line: 5;)\n\n- :warning: Hello updates\n\n\n " ,
324+ author : {
325+ name : "userNAME" ,
326+ } ,
327+ } ,
328+ commentAnchor : {
329+ line : 5 ,
330+ lineType : "ADDED" ,
331+ } ,
332+ } ,
333+ ] ,
334+ } )
335+ const comments = await api . getDangerInlineComments ( "default" )
336+ expect ( api . fetch ) . toHaveBeenCalledWith (
337+ `${ host } /rest/api/1.0/projects/FOO/repos/BAR/pull-requests/1/activities?fromType=COMMENT&start=0` ,
338+ { method : "GET" , body : null , headers : expectedJSONHeaders } ,
339+ undefined
340+ )
341+ expect ( comments . length ) . toEqual ( 1 )
342+ expect ( comments [ 0 ] . ownedByDanger ) . toBeTruthy ( )
343+ } )
344+
273345 it ( "getFileContents" , async ( ) => {
274346 textResult = "contents..."
275347 const result = await api . getFileContents ( "path/folder with space/foo.txt" , "projects/FOO/repos/BAR" , "master" )
0 commit comments