@@ -265,6 +265,34 @@ class TestBitbucketServerContextParser {
265
265
} ) ;
266
266
}
267
267
268
+ @test async test_branch_context_02 ( ) {
269
+ const result = await this . parser . handle (
270
+ { } ,
271
+ this . user ,
272
+ // here we don't provide the `refs/heads/` prefix, forcing the context parser to query the API to figure out the refType
273
+ "https://bitbucket.gitpod-dev.com/users/svenefftinge/repos/browser-extension-test/commits?until=my-branch&merges=include" ,
274
+ ) ;
275
+
276
+ expect ( result ) . to . deep . include ( {
277
+ ref : "my-branch" ,
278
+ refType : "branch" ,
279
+ revision : "3ca42b45bc693973cb21a112a418c13f8b4d11a5" ,
280
+ path : "" ,
281
+ isFile : false ,
282
+ repository : {
283
+ cloneUrl : "https://bitbucket.gitpod-dev.com/scm/~svenefftinge/browser-extension-test.git" ,
284
+ defaultBranch : "main" ,
285
+ host : "bitbucket.gitpod-dev.com" ,
286
+ name : "browser-extension-test" ,
287
+ owner : "svenefftinge" ,
288
+ repoKind : "users" ,
289
+ private : false ,
290
+ webUrl : "https://bitbucket.gitpod-dev.com/users/svenefftinge/repos/browser-extension-test" ,
291
+ } ,
292
+ title : "svenefftinge/browser-extension-test - my-branch" ,
293
+ } ) ;
294
+ }
295
+
268
296
@test async test_PR_context_01 ( ) {
269
297
const result = await this . parser . handle (
270
298
{ } ,
@@ -370,6 +398,32 @@ class TestBitbucketServerContextParser {
370
398
} ) ;
371
399
}
372
400
401
+ @test async test_tag_context_02 ( ) {
402
+ const result = await this . parser . handle (
403
+ { } ,
404
+ this . user ,
405
+ // here we don't provide the `refs/tags/` prefix, forcing the context parser to query the API to figure out the refType
406
+ "https://bitbucket.gitpod-dev.com/projects/GIT/repos/gitpod-test-repo/browse?at=test-tag-v1.0.1" ,
407
+ ) ;
408
+
409
+ expect ( result ) . to . deep . include ( {
410
+ title : "GIT/gitpod-test-repo - test-tag-v1.0.1" ,
411
+ ref : "test-tag-v1.0.1" ,
412
+ refType : "tag" ,
413
+ revision : "506e5aed317f28023994ecf8ca6ed91430e9c1a4" ,
414
+ repository : {
415
+ host : "bitbucket.gitpod-dev.com" ,
416
+ owner : "GIT" ,
417
+ name : "gitpod-test-repo" ,
418
+ cloneUrl : "https://bitbucket.gitpod-dev.com/scm/git/gitpod-test-repo.git" ,
419
+ webUrl : "https://bitbucket.gitpod-dev.com/projects/GIT/repos/gitpod-test-repo" ,
420
+ defaultBranch : "master" ,
421
+ private : true ,
422
+ repoKind : "projects" ,
423
+ } ,
424
+ } ) ;
425
+ }
426
+
373
427
@test test_toSimpleBranchName ( ) {
374
428
const url = new URL (
375
429
"https://bitbucket.gitpod-dev.com/projects/GIT/repos/gitpod-test-repo/browse?at=refs%2Fheads%2Ffoo" ,
0 commit comments