@@ -88,7 +88,7 @@ class TestBitbucketServerContextParser {
88
88
expect ( result ) . to . deep . include ( {
89
89
ref : "master" ,
90
90
refType : "branch" ,
91
- revision : "535924584468074ec5dcbe935f4e68fbc3f0cb2d " ,
91
+ revision : "9eea1cca9bb98f0caf7ae77c740d5d24548ff33c " ,
92
92
path : "" ,
93
93
isFile : false ,
94
94
repository : {
@@ -115,7 +115,7 @@ class TestBitbucketServerContextParser {
115
115
expect ( result ) . to . deep . include ( {
116
116
ref : "master" ,
117
117
refType : "branch" ,
118
- revision : "535924584468074ec5dcbe935f4e68fbc3f0cb2d " ,
118
+ revision : "9eea1cca9bb98f0caf7ae77c740d5d24548ff33c " ,
119
119
path : "" ,
120
120
isFile : false ,
121
121
repository : {
@@ -142,7 +142,7 @@ class TestBitbucketServerContextParser {
142
142
expect ( result ) . to . deep . include ( {
143
143
ref : "main" ,
144
144
refType : "branch" ,
145
- revision : "a15d7d15adee54d0afdbe88148c8e587e8fb609d " ,
145
+ revision : "d4bdb1459f9fc90756154bdda5eb23c39457a89c " ,
146
146
path : "" ,
147
147
isFile : false ,
148
148
repository : {
@@ -158,6 +158,152 @@ class TestBitbucketServerContextParser {
158
158
title : "alextugarev/tada - main" ,
159
159
} ) ;
160
160
}
161
+
162
+ @test async test_commit_context_01 ( ) {
163
+ const result = await this . parser . handle (
164
+ { } ,
165
+ this . user ,
166
+ "https://bitbucket.gitpod-self-hosted.com/users/jan/repos/yolo/commits/ec15264e536e9684034ea8e08f3afc3fd485b613" ,
167
+ ) ;
168
+
169
+ expect ( result ) . to . deep . include ( {
170
+ refType : "revision" ,
171
+ revision : "ec15264e536e9684034ea8e08f3afc3fd485b613" ,
172
+ path : "" ,
173
+ isFile : false ,
174
+ repository : {
175
+ cloneUrl : "https://bitbucket.gitpod-self-hosted.com/scm/~jan/yolo.git" ,
176
+ defaultBranch : "master" ,
177
+ host : "bitbucket.gitpod-self-hosted.com" ,
178
+ name : "YOLO" ,
179
+ owner : "jan" ,
180
+ private : true ,
181
+ repoKind : "users" ,
182
+ webUrl : "https://bitbucket.gitpod-self-hosted.com/users/jan/repos/yolo" ,
183
+ } ,
184
+ title : "jan/yolo - ec15264e536e9684034ea8e08f3afc3fd485b613" ,
185
+ } ) ;
186
+ }
187
+
188
+ @test async test_PR_context_01 ( ) {
189
+ const result = await this . parser . handle (
190
+ { } ,
191
+ this . user ,
192
+ "https://bitbucket.gitpod-self-hosted.com/projects/FOO/repos/repo123/pull-requests/1/commits" ,
193
+ ) ;
194
+
195
+ expect ( result ) . to . deep . include ( {
196
+ title : "Let's do it" ,
197
+ nr : 1 ,
198
+ ref : "foo" ,
199
+ refType : "branch" ,
200
+ revision : "1384b6842d73b8705feaf45f3e8aa41f00529042" ,
201
+ repository : {
202
+ host : "bitbucket.gitpod-self-hosted.com" ,
203
+ owner : "FOO" ,
204
+ name : "repo123" ,
205
+ cloneUrl : "https://bitbucket.gitpod-self-hosted.com/scm/foo/repo123.git" ,
206
+ webUrl : "https://bitbucket.gitpod-self-hosted.com/projects/FOO/repos/repo123" ,
207
+ defaultBranch : "master" ,
208
+ private : true ,
209
+ repoKind : "projects" ,
210
+ } ,
211
+ base : {
212
+ ref : "master" ,
213
+ refType : "branch" ,
214
+ repository : {
215
+ host : "bitbucket.gitpod-self-hosted.com" ,
216
+ owner : "FOO" ,
217
+ name : "repo123" ,
218
+ cloneUrl : "https://bitbucket.gitpod-self-hosted.com/scm/foo/repo123.git" ,
219
+ webUrl : "https://bitbucket.gitpod-self-hosted.com/projects/FOO/repos/repo123" ,
220
+ defaultBranch : "master" ,
221
+ private : true ,
222
+ repoKind : "projects" ,
223
+ } ,
224
+ } ,
225
+ } ) ;
226
+ }
227
+
228
+ @test async test_PR_context_02 ( ) {
229
+ const result = await this . parser . handle (
230
+ { } ,
231
+ this . user ,
232
+ "https://bitbucket.gitpod-self-hosted.com/projects/FOO/repos/repo123/pull-requests/2/overview" ,
233
+ ) ;
234
+
235
+ expect ( result ) . to . deep . include ( {
236
+ title : "Let's do it again" ,
237
+ nr : 2 ,
238
+ ref : "foo" ,
239
+ refType : "branch" ,
240
+ revision : "1384b6842d73b8705feaf45f3e8aa41f00529042" ,
241
+ repository : {
242
+ host : "bitbucket.gitpod-self-hosted.com" ,
243
+ owner : "LAL" ,
244
+ name : "repo123" ,
245
+ cloneUrl : "https://bitbucket.gitpod-self-hosted.com/scm/lal/repo123.git" ,
246
+ webUrl : "https://bitbucket.gitpod-self-hosted.com/projects/LAL/repos/repo123" ,
247
+ defaultBranch : "master" ,
248
+ private : true ,
249
+ repoKind : "projects" ,
250
+ } ,
251
+ base : {
252
+ ref : "master" ,
253
+ refType : "branch" ,
254
+ repository : {
255
+ host : "bitbucket.gitpod-self-hosted.com" ,
256
+ owner : "FOO" ,
257
+ name : "repo123" ,
258
+ cloneUrl : "https://bitbucket.gitpod-self-hosted.com/scm/foo/repo123.git" ,
259
+ webUrl : "https://bitbucket.gitpod-self-hosted.com/projects/FOO/repos/repo123" ,
260
+ defaultBranch : "master" ,
261
+ private : true ,
262
+ repoKind : "projects" ,
263
+ } ,
264
+ } ,
265
+ } ) ;
266
+ }
267
+
268
+ @test async test_PR_context_03 ( ) {
269
+ const result = await this . parser . handle (
270
+ { } ,
271
+ this . user ,
272
+ "https://bitbucket.gitpod-self-hosted.com/projects/LAL/repos/repo123/pull-requests/1/overview" ,
273
+ ) ;
274
+
275
+ expect ( result ) . to . deep . include ( {
276
+ title : "U turn" ,
277
+ nr : 1 ,
278
+ ref : "foo" ,
279
+ refType : "branch" ,
280
+ revision : "1384b6842d73b8705feaf45f3e8aa41f00529042" ,
281
+ repository : {
282
+ host : "bitbucket.gitpod-self-hosted.com" ,
283
+ owner : "FOO" ,
284
+ name : "repo123" ,
285
+ cloneUrl : "https://bitbucket.gitpod-self-hosted.com/scm/foo/repo123.git" ,
286
+ webUrl : "https://bitbucket.gitpod-self-hosted.com/projects/FOO/repos/repo123" ,
287
+ defaultBranch : "master" ,
288
+ private : true ,
289
+ repoKind : "projects" ,
290
+ } ,
291
+ base : {
292
+ ref : "master" ,
293
+ refType : "branch" ,
294
+ repository : {
295
+ host : "bitbucket.gitpod-self-hosted.com" ,
296
+ owner : "LAL" ,
297
+ name : "repo123" ,
298
+ cloneUrl : "https://bitbucket.gitpod-self-hosted.com/scm/lal/repo123.git" ,
299
+ webUrl : "https://bitbucket.gitpod-self-hosted.com/projects/LAL/repos/repo123" ,
300
+ defaultBranch : "master" ,
301
+ private : true ,
302
+ repoKind : "projects" ,
303
+ } ,
304
+ } ,
305
+ } ) ;
306
+ }
161
307
}
162
308
163
309
module . exports = new TestBitbucketServerContextParser ( ) ;
0 commit comments