@@ -31,7 +31,7 @@ class TestBitbucketServerFileProvider {
3131 verified : true ,
3232 description : "" ,
3333 icon : "" ,
34- host : "bitbucket.gitpod-self-hosted .com" ,
34+ host : "bitbucket.gitpod-dev .com" ,
3535 oauth : {
3636 callBackUrl : "" ,
3737 clientId : "not-used" ,
@@ -45,7 +45,7 @@ class TestBitbucketServerFileProvider {
4545 public before ( ) {
4646 const container = new Container ( ) ;
4747 container . load (
48- new ContainerModule ( ( bind , unbind , isBound , rebind ) => {
48+ new ContainerModule ( ( bind ) => {
4949 bind ( BitbucketServerFileProvider ) . toSelf ( ) . inSingletonScope ( ) ;
5050 bind ( BitbucketServerContextParser ) . toSelf ( ) . inSingletonScope ( ) ;
5151 bind ( AuthProviderParams ) . toConstantValue ( TestBitbucketServerFileProvider . AUTH_HOST_CONFIG ) ;
@@ -93,13 +93,13 @@ class TestBitbucketServerFileProvider {
9393 const result = await this . service . getGitpodFileContent (
9494 // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
9595 {
96- revision : "master " ,
96+ revision : "main " ,
9797 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 " ,
103103 } ,
104104 } as any ,
105105 this . user ,
@@ -111,19 +111,43 @@ class TestBitbucketServerFileProvider {
111111 @test async test_getLastChangeRevision_ok ( ) {
112112 const result = await this . service . getLastChangeRevision (
113113 {
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 " ,
121121 } as Repository ,
122- "foo " ,
122+ "ft/invalid-docker " ,
123123 this . user ,
124- "folder/sub/test.txt " ,
124+ ".gitpod.yml " ,
125125 ) ;
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 ;
127151 }
128152}
129153
0 commit comments