1
1
import { SCMLib } from './scm'
2
2
import {
3
3
CreateSubmitRequestParams ,
4
+ GetGitBlameReponse ,
4
5
GetRefererenceResult ,
6
+ ReferenceType ,
5
7
ScmLibScmType ,
6
8
ScmRepoInfo ,
7
9
ScmSubmitRequestStatus ,
@@ -16,108 +18,108 @@ export class StubSCMLib extends SCMLib {
16
18
super ( url , accessToken , scmOrg )
17
19
}
18
20
19
- public override getUrlWithCredentials ( ) : Promise < string > {
20
- console . error ( 'getUrlWithCredentials() not implemented ' )
21
- throw new Error ( 'getUrlWithCredentials() not implemented' )
21
+ public override async getUrlWithCredentials ( ) : Promise < string > {
22
+ console . warn ( 'getUrlWithCredentials() returning empty string ' )
23
+ return ''
22
24
}
23
25
24
26
async createSubmitRequest (
25
27
_params : CreateSubmitRequestParams
26
28
) : Promise < string > {
27
- console . error ( 'createSubmitRequest() not implemented ' )
28
- throw new Error ( 'createSubmitRequest() not implemented' )
29
+ console . warn ( 'createSubmitRequest() returning empty string ' )
30
+ return ''
29
31
}
30
32
31
33
get scmLibType ( ) : ScmLibScmType {
32
- console . error ( 'getScmLibType() not implemented ')
33
- throw new Error ( 'getScmLibType() not implemented' )
34
+ console . warn ( 'scmLibType returning GITHUB as default ')
35
+ return ScmLibScmType . GITHUB
34
36
}
35
37
36
38
getAuthHeaders ( ) : Record < string , string > {
37
- console . error ( 'getAuthHeaders() not implemented ' )
38
- throw new Error ( 'getAuthHeaders() not implemented' )
39
+ console . warn ( 'getAuthHeaders() returning empty object ' )
40
+ return { }
39
41
}
40
42
41
- getDownloadUrl ( _sha : string ) : Promise < string > {
42
- console . error ( 'getDownloadUrl() not implemented ' )
43
- throw new Error ( 'getDownloadUrl() not implemented' )
43
+ async getDownloadUrl ( _sha : string ) : Promise < string > {
44
+ console . warn ( 'getDownloadUrl() returning empty string ' )
45
+ return ''
44
46
}
45
47
46
48
async getIsRemoteBranch ( _branch : string ) : Promise < boolean > {
47
- console . error ( 'getIsRemoteBranch() not implemented ' )
48
- throw new Error ( 'getIsRemoteBranch() not implemented' )
49
+ console . warn ( 'getIsRemoteBranch() returning false ' )
50
+ return false
49
51
}
50
52
51
- async validateParams ( ) {
52
- console . error ( 'validateParams() not implemented' )
53
- throw new Error ( 'validateParams() not implemented' )
53
+ async validateParams ( ) : Promise < void > {
54
+ console . warn ( 'validateParams() no-op' )
54
55
}
55
56
56
57
async getRepoList ( _scmOrg : string | undefined ) : Promise < ScmRepoInfo [ ] > {
57
- console . error ( 'getRepoList() not implemented ' )
58
- throw new Error ( 'getRepoList() not implemented' )
58
+ console . warn ( 'getRepoList() returning empty array ' )
59
+ return [ ]
59
60
}
60
61
61
62
async getBranchList ( ) : Promise < string [ ] > {
62
- console . error ( 'getBranchList() not implemented ' )
63
- throw new Error ( 'getBranchList() not implemented' )
63
+ console . warn ( 'getBranchList() returning empty array ' )
64
+ return [ ]
64
65
}
65
66
66
67
async getUsername ( ) : Promise < string > {
67
- console . error ( 'getUsername() not implemented ' )
68
- throw new Error ( 'getUsername() not implemented' )
68
+ console . warn ( 'getUsername() returning empty string ' )
69
+ return ''
69
70
}
70
71
71
72
async getSubmitRequestStatus (
72
73
_scmSubmitRequestId : string
73
74
) : Promise < ScmSubmitRequestStatus > {
74
- console . error ( 'getSubmitRequestStatus() not implemented ' )
75
- throw new Error ( 'getSubmitRequestStatus() not implemented' )
75
+ console . warn ( 'getSubmitRequestStatus() returning ERROR ' )
76
+ return 'error'
76
77
}
77
78
78
79
async getUserHasAccessToRepo ( ) : Promise < boolean > {
79
- console . error ( 'getUserHasAccessToRepo() not implemented ' )
80
- throw new Error ( 'getUserHasAccessToRepo() not implemented' )
80
+ console . warn ( 'getUserHasAccessToRepo() returning false ' )
81
+ return false
81
82
}
82
83
83
84
async getRepoBlameRanges (
84
85
_ref : string ,
85
86
_path : string
86
- ) : Promise <
87
- {
88
- startingLine : number
89
- endingLine : number
90
- name : string
91
- login : string
92
- email : string
93
- } [ ]
94
- > {
95
- console . error ( 'getRepoBlameRanges() not implemented' )
96
- throw new Error ( 'getRepoBlameRanges() not implemented' )
87
+ ) : Promise < GetGitBlameReponse > {
88
+ console . warn ( 'getRepoBlameRanges() returning empty array' )
89
+ return [ ]
97
90
}
98
91
99
92
async getReferenceData ( _ref : string ) : Promise < GetRefererenceResult > {
100
- console . error ( 'getReferenceData() not implemented' )
101
- throw new Error ( 'getReferenceData() not implemented' )
93
+ console . warn ( 'getReferenceData() returning null/empty defaults' )
94
+ return {
95
+ type : ReferenceType . BRANCH ,
96
+ sha : '' ,
97
+ date : undefined ,
98
+ }
102
99
}
103
100
104
101
async getRepoDefaultBranch ( ) : Promise < string > {
105
- console . error ( 'getRepoDefaultBranch() not implemented ' )
106
- throw new Error ( 'getRepoDefaultBranch() not implemented' )
102
+ console . warn ( 'getRepoDefaultBranch() returning empty string ' )
103
+ return ''
107
104
}
105
+
108
106
async getPrUrl ( _prNumber : number ) : Promise < string > {
109
- console . error ( 'getPr () not implemented ')
110
- throw new Error ( 'getPr() not implemented' )
107
+ console . warn ( 'getPrUrl () returning empty string ')
108
+ return ''
111
109
}
110
+
112
111
async getPrId ( _prUrl : string ) : Promise < string > {
113
- console . error ( 'getPrId() not implemented ' )
114
- throw new Error ( 'getPrId() not implemented' )
112
+ console . warn ( 'getPrId() returning empty string ' )
113
+ return ''
115
114
}
115
+
116
116
async getCommitUrl ( _commitId : string ) : Promise < string > {
117
- console . error ( 'getCommitUrl() not implemented ' )
118
- throw new Error ( 'getCommitUrl() not implemented' )
117
+ console . warn ( 'getCommitUrl() returning empty string ' )
118
+ return ''
119
119
}
120
- _getUsernameForAuthUrl ( ) : Promise < string > {
121
- throw new Error ( 'Method not implemented.' )
120
+
121
+ async _getUsernameForAuthUrl ( ) : Promise < string > {
122
+ console . warn ( '_getUsernameForAuthUrl() returning empty string' )
123
+ return ''
122
124
}
123
125
}
0 commit comments