@@ -31,7 +31,7 @@ class TestBitbucketServerFileProvider {
31
31
verified : true ,
32
32
description : "" ,
33
33
icon : "" ,
34
- host : "bitbucket.gitpod-self-hosted .com" ,
34
+ host : "bitbucket.gitpod-dev .com" ,
35
35
oauth : {
36
36
callBackUrl : "" ,
37
37
clientId : "not-used" ,
@@ -45,7 +45,7 @@ class TestBitbucketServerFileProvider {
45
45
public before ( ) {
46
46
const container = new Container ( ) ;
47
47
container . load (
48
- new ContainerModule ( ( bind , unbind , isBound , rebind ) => {
48
+ new ContainerModule ( ( bind ) => {
49
49
bind ( BitbucketServerFileProvider ) . toSelf ( ) . inSingletonScope ( ) ;
50
50
bind ( BitbucketServerContextParser ) . toSelf ( ) . inSingletonScope ( ) ;
51
51
bind ( AuthProviderParams ) . toConstantValue ( TestBitbucketServerFileProvider . AUTH_HOST_CONFIG ) ;
@@ -93,13 +93,13 @@ class TestBitbucketServerFileProvider {
93
93
const result = await this . service . getGitpodFileContent (
94
94
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
95
95
{
96
- revision : "master " ,
96
+ revision : "main " ,
97
97
repository : < Repository > {
98
- cloneUrl : "https://bitbucket.gitpod-self-hosted .com/projects/FOO /repos/repo123 " ,
99
- webUrl : "https://bitbucket.gitpod-self-hosted .com/projects/FOO /repos/repo123 " ,
100
- name : "repo123 " ,
101
- repoKind : "projects " ,
102
- owner : "FOO " ,
98
+ cloneUrl : "https://bitbucket.gitpod-dev .com/users/filip /repos/spring-petclinic " ,
99
+ webUrl : "https://bitbucket.gitpod-dev .com/users/filip /repos/spring-petclinic " ,
100
+ name : "spring-petclinic " ,
101
+ repoKind : "users " ,
102
+ owner : "filip " ,
103
103
} ,
104
104
} as any ,
105
105
this . user ,
@@ -111,19 +111,43 @@ class TestBitbucketServerFileProvider {
111
111
@test async test_getLastChangeRevision_ok ( ) {
112
112
const result = await this . service . getLastChangeRevision (
113
113
{
114
- owner : "FOO " ,
115
- name : "repo123 " ,
116
- repoKind : "projects " ,
117
- revision : "foo " ,
118
- host : "bitbucket.gitpod-self-hosted .com" ,
119
- cloneUrl : "https://bitbucket.gitpod-self-hosted .com/projects/FOO /repos/repo123 " ,
120
- webUrl : "https://bitbucket.gitpod-self-hosted .com/projects/FOO /repos/repo123 " ,
114
+ owner : "filip " ,
115
+ name : "spring-petclinic " ,
116
+ repoKind : "users " ,
117
+ revision : "ft/invalid-docker " ,
118
+ host : "bitbucket.gitpod-dev .com" ,
119
+ cloneUrl : "https://bitbucket.gitpod-dev .com/users/filip /repos/spring-petclinic " ,
120
+ webUrl : "https://bitbucket.gitpod-dev .com/users/filip /repos/spring-petclinic " ,
121
121
} as Repository ,
122
- "foo " ,
122
+ "ft/invalid-docker " ,
123
123
this . user ,
124
- "folder/sub/test.txt " ,
124
+ ".gitpod.yml " ,
125
125
) ;
126
- expect ( result ) . to . equal ( "1384b6842d73b8705feaf45f3e8aa41f00529042" ) ;
126
+ expect ( result ) . to . equal ( "7e38d77cc599682f543f71da36328307e35caa94" ) ;
127
+ }
128
+
129
+ @test async test_getLastChangeRevision_not_found ( ) {
130
+ // it looks like expecting a promise to throw doesn't work, so we hack it with a try-catch
131
+ let didThrow = false ;
132
+ try {
133
+ await this . service . getLastChangeRevision (
134
+ {
135
+ owner : "filip" ,
136
+ name : "spring-petclinic" ,
137
+ repoKind : "users" ,
138
+ revision : "ft/invalid-docker" ,
139
+ host : "bitbucket.gitpod-dev.com" ,
140
+ cloneUrl : "https://bitbucket.gitpod-dev.com/users/filip/repos/spring-petclinic" ,
141
+ webUrl : "https://bitbucket.gitpod-dev.com/users/filip/repos/spring-petclinic" ,
142
+ } as Repository ,
143
+ "ft/invalid-docker" ,
144
+ this . user ,
145
+ "gitpod.Dockerfile" ,
146
+ ) ;
147
+ } catch ( err ) {
148
+ didThrow = true ;
149
+ }
150
+ expect ( didThrow ) . to . be . true ;
127
151
}
128
152
}
129
153
0 commit comments