1
1
beforeEach ( ( ) => {
2
2
process . env [ "GITHUB_REPOSITORY" ] = "marocchino/stick-pull-request-comment"
3
+ process . env [ "INPUT_BASE_URL" ] = "https://api.github.com"
3
4
process . env [ "INPUT_NUMBER" ] = "123"
4
5
process . env [ "INPUT_APPEND" ] = "false"
5
6
process . env [ "INPUT_RECREATE" ] = "false"
@@ -18,6 +19,7 @@ beforeEach(() => {
18
19
afterEach ( ( ) => {
19
20
jest . resetModules ( )
20
21
delete process . env [ "GITHUB_REPOSITORY" ]
22
+ delete process . env [ "INPUT_BASE_URL" ]
21
23
delete process . env [ "INPUT_OWNER" ]
22
24
delete process . env [ "INPUT_REPO" ]
23
25
delete process . env [ "INPUT_HEADER" ]
@@ -38,10 +40,29 @@ afterEach(() => {
38
40
delete process . env [ "INPUT_FOLLOW_SYMBOLIC_LINKS" ]
39
41
} )
40
42
43
+ test ( "baseUrl" , async ( ) => {
44
+ process . env [ "INPUT_BASE_URL" ] = "https://repo.yourcompany.com"
45
+ expect ( require ( "../src/config" ) ) . toMatchObject ( {
46
+ baseUrl : "https://repo.yourcompany.com" ,
47
+ pullRequestNumber : expect . any ( Number ) ,
48
+ repo : { owner : "marocchino" , repo : "stick-pull-request-comment" } ,
49
+ header : "" ,
50
+ append : false ,
51
+ recreate : false ,
52
+ deleteOldComment : false ,
53
+ hideOldComment : false ,
54
+ hideAndRecreate : false ,
55
+ hideClassify : "OUTDATED" ,
56
+ hideDetails : false ,
57
+ githubToken : "some-token" ,
58
+ ignoreEmpty : false
59
+ } )
60
+ } )
41
61
test ( "repo" , async ( ) => {
42
62
process . env [ "INPUT_OWNER" ] = "jin"
43
63
process . env [ "INPUT_REPO" ] = "other"
44
64
expect ( require ( "../src/config" ) ) . toMatchObject ( {
65
+ baseUrl : "https://api.github.com" ,
45
66
pullRequestNumber : expect . any ( Number ) ,
46
67
repo : { owner : "jin" , repo : "other" } ,
47
68
header : "" ,
@@ -60,6 +81,7 @@ test("repo", async () => {
60
81
test ( "header" , async ( ) => {
61
82
process . env [ "INPUT_HEADER" ] = "header"
62
83
expect ( require ( "../src/config" ) ) . toMatchObject ( {
84
+ baseUrl : "https://api.github.com" ,
63
85
pullRequestNumber : expect . any ( Number ) ,
64
86
repo : { owner : "marocchino" , repo : "stick-pull-request-comment" } ,
65
87
header : "header" ,
@@ -78,6 +100,7 @@ test("header", async () => {
78
100
test ( "append" , async ( ) => {
79
101
process . env [ "INPUT_APPEND" ] = "true"
80
102
expect ( require ( "../src/config" ) ) . toMatchObject ( {
103
+ baseUrl : "https://api.github.com" ,
81
104
pullRequestNumber : expect . any ( Number ) ,
82
105
repo : { owner : "marocchino" , repo : "stick-pull-request-comment" } ,
83
106
header : "" ,
@@ -96,6 +119,7 @@ test("append", async () => {
96
119
test ( "recreate" , async ( ) => {
97
120
process . env [ "INPUT_RECREATE" ] = "true"
98
121
expect ( require ( "../src/config" ) ) . toMatchObject ( {
122
+ baseUrl : "https://api.github.com" ,
99
123
pullRequestNumber : expect . any ( Number ) ,
100
124
repo : { owner : "marocchino" , repo : "stick-pull-request-comment" } ,
101
125
header : "" ,
@@ -114,6 +138,7 @@ test("recreate", async () => {
114
138
test ( "delete" , async ( ) => {
115
139
process . env [ "INPUT_DELETE" ] = "true"
116
140
expect ( require ( "../src/config" ) ) . toMatchObject ( {
141
+ baseUrl : "https://api.github.com" ,
117
142
pullRequestNumber : expect . any ( Number ) ,
118
143
repo : { owner : "marocchino" , repo : "stick-pull-request-comment" } ,
119
144
header : "" ,
@@ -132,6 +157,7 @@ test("delete", async () => {
132
157
test ( "hideOldComment" , async ( ) => {
133
158
process . env [ "INPUT_HIDE" ] = "true"
134
159
expect ( require ( "../src/config" ) ) . toMatchObject ( {
160
+ baseUrl : "https://api.github.com" ,
135
161
pullRequestNumber : expect . any ( Number ) ,
136
162
repo : { owner : "marocchino" , repo : "stick-pull-request-comment" } ,
137
163
header : "" ,
@@ -150,6 +176,7 @@ test("hideOldComment", async () => {
150
176
test ( "hideAndRecreate" , async ( ) => {
151
177
process . env [ "INPUT_HIDE_AND_RECREATE" ] = "true"
152
178
expect ( require ( "../src/config" ) ) . toMatchObject ( {
179
+ baseUrl : "https://api.github.com" ,
153
180
pullRequestNumber : expect . any ( Number ) ,
154
181
repo : { owner : "marocchino" , repo : "stick-pull-request-comment" } ,
155
182
header : "" ,
@@ -168,6 +195,7 @@ test("hideAndRecreate", async () => {
168
195
test ( "hideClassify" , async ( ) => {
169
196
process . env [ "INPUT_HIDE_CLASSIFY" ] = "OFF_TOPIC"
170
197
expect ( require ( "../src/config" ) ) . toMatchObject ( {
198
+ baseUrl : "https://api.github.com" ,
171
199
pullRequestNumber : expect . any ( Number ) ,
172
200
repo : { owner : "marocchino" , repo : "stick-pull-request-comment" } ,
173
201
header : "" ,
@@ -186,6 +214,7 @@ test("hideClassify", async () => {
186
214
test ( "hideDetails" , async ( ) => {
187
215
process . env [ "INPUT_HIDE_DETAILS" ] = "true"
188
216
expect ( require ( "../src/config" ) ) . toMatchObject ( {
217
+ baseUrl : "https://api.github.com" ,
189
218
pullRequestNumber : expect . any ( Number ) ,
190
219
repo : { owner : "marocchino" , repo : "stick-pull-request-comment" } ,
191
220
header : "" ,
@@ -205,6 +234,7 @@ describe("path", () => {
205
234
test ( "when exists return content of a file" , async ( ) => {
206
235
process . env [ "INPUT_PATH" ] = "./__tests__/assets/result"
207
236
expect ( require ( "../src/config" ) ) . toMatchObject ( {
237
+ baseUrl : "https://api.github.com" ,
208
238
pullRequestNumber : expect . any ( Number ) ,
209
239
repo : { owner : "marocchino" , repo : "stick-pull-request-comment" } ,
210
240
header : "" ,
@@ -224,6 +254,7 @@ describe("path", () => {
224
254
test ( "glob match files" , async ( ) => {
225
255
process . env [ "INPUT_PATH" ] = "./__tests__/assets/*"
226
256
expect ( require ( "../src/config" ) ) . toMatchObject ( {
257
+ baseUrl : "https://api.github.com" ,
227
258
pullRequestNumber : expect . any ( Number ) ,
228
259
repo : { owner : "marocchino" , repo : "stick-pull-request-comment" } ,
229
260
header : "" ,
@@ -245,6 +276,7 @@ describe("path", () => {
245
276
test ( "when not exists return null string" , async ( ) => {
246
277
process . env [ "INPUT_PATH" ] = "./__tests__/assets/not_exists"
247
278
expect ( require ( "../src/config" ) ) . toMatchObject ( {
279
+ baseUrl : "https://api.github.com" ,
248
280
pullRequestNumber : expect . any ( Number ) ,
249
281
repo : { owner : "marocchino" , repo : "stick-pull-request-comment" } ,
250
282
header : "" ,
@@ -265,6 +297,7 @@ describe("path", () => {
265
297
test ( "message" , async ( ) => {
266
298
process . env [ "INPUT_MESSAGE" ] = "hello there"
267
299
expect ( require ( "../src/config" ) ) . toMatchObject ( {
300
+ baseUrl : "https://api.github.com" ,
268
301
pullRequestNumber : expect . any ( Number ) ,
269
302
repo : { owner : "marocchino" , repo : "stick-pull-request-comment" } ,
270
303
header : "" ,
@@ -284,6 +317,7 @@ test("message", async () => {
284
317
test ( "ignore_empty" , async ( ) => {
285
318
process . env [ "INPUT_IGNORE_EMPTY" ] = "true"
286
319
expect ( require ( "../src/config" ) ) . toMatchObject ( {
320
+ baseUrl : "https://api.github.com" ,
287
321
pullRequestNumber : expect . any ( Number ) ,
288
322
repo : { owner : "marocchino" , repo : "stick-pull-request-comment" } ,
289
323
header : "" ,
0 commit comments