@@ -20,7 +20,7 @@ describe('Request info', () => {
20
20
21
21
github = {
22
22
repos : {
23
- getContent : expect . createSpy ( ) . andReturn ( Promise . resolve ( {
23
+ getContents : expect . createSpy ( ) . andReturn ( Promise . resolve ( {
24
24
data : {
25
25
content : Buffer . from ( `requestInfoLabelToAdd: needs-more-info\nrequestInfoDefaultTitles:\n - readme.md\nrequestInfoReplyComment: >\n Reply comment` ) . toString ( 'base64' )
26
26
}
@@ -39,7 +39,7 @@ describe('Request info', () => {
39
39
it ( 'there wasn\'t enough info provided in an issue' , async ( ) => {
40
40
await app . receive ( issueSuccessEvent )
41
41
42
- expect ( github . repos . getContent ) . toHaveBeenCalledWith ( {
42
+ expect ( github . repos . getContents ) . toHaveBeenCalledWith ( {
43
43
owner : 'hiimbex' ,
44
44
repo : 'testing-things' ,
45
45
path : '.github/config.yml'
@@ -54,7 +54,7 @@ describe('Request info', () => {
54
54
it ( 'there wasn\'t enough info provided in a pull request' , async ( ) => {
55
55
await app . receive ( prSuccessEvent )
56
56
57
- expect ( github . repos . getContent ) . toHaveBeenCalledWith ( {
57
+ expect ( github . repos . getContents ) . toHaveBeenCalledWith ( {
58
58
owner : 'hiimbex' ,
59
59
repo : 'testing-things' ,
60
60
path : '.github/config.yml'
@@ -69,7 +69,7 @@ describe('Request info', () => {
69
69
it ( 'there was a body in issue' , async ( ) => {
70
70
await app . receive ( issueFailEvent )
71
71
72
- expect ( github . repos . getContent ) . toHaveBeenCalledWith ( {
72
+ expect ( github . repos . getContents ) . toHaveBeenCalledWith ( {
73
73
owner : 'hiimbex' ,
74
74
repo : 'testing-things' ,
75
75
path : '.github/config.yml'
@@ -83,7 +83,7 @@ describe('Request info', () => {
83
83
84
84
describe ( 'Request info disabled for issues' , ( ) => {
85
85
beforeEach ( ( ) => {
86
- github . repos . getContent . andReturn ( Promise . resolve ( {
86
+ github . repos . getContents . andReturn ( Promise . resolve ( {
87
87
data : {
88
88
content : Buffer . from ( `requestInfoLabelToAdd: needs-more-info\nrequestInfoDefaultTitles:\n - readme.md\nrequestInfoReplyComment: >\n Reply comment\nrequestInfoOn:\n issue: false\n pullRequest: true\n` ) . toString ( 'base64' )
89
89
}
@@ -94,7 +94,7 @@ describe('Request info', () => {
94
94
it ( "'issue' type is disabled even if there wasn't enough info provided" , async ( ) => {
95
95
await app . receive ( issueSuccessEvent )
96
96
97
- expect ( github . repos . getContent ) . toHaveBeenCalledWith ( {
97
+ expect ( github . repos . getContents ) . toHaveBeenCalledWith ( {
98
98
owner : 'hiimbex' ,
99
99
repo : 'testing-things' ,
100
100
path : '.github/config.yml'
@@ -109,7 +109,7 @@ describe('Request info', () => {
109
109
it ( 'there was a body in issue' , async ( ) => {
110
110
await app . receive ( issueFailEvent )
111
111
112
- expect ( github . repos . getContent ) . toHaveBeenCalledWith ( {
112
+ expect ( github . repos . getContents ) . toHaveBeenCalledWith ( {
113
113
owner : 'hiimbex' ,
114
114
repo : 'testing-things' ,
115
115
path : '.github/config.yml'
@@ -124,7 +124,7 @@ describe('Request info', () => {
124
124
it ( 'there wasn\'t enough info provided in a pull request' , async ( ) => {
125
125
await app . receive ( prSuccessEvent )
126
126
127
- expect ( github . repos . getContent ) . toHaveBeenCalledWith ( {
127
+ expect ( github . repos . getContents ) . toHaveBeenCalledWith ( {
128
128
owner : 'hiimbex' ,
129
129
repo : 'testing-things' ,
130
130
path : '.github/config.yml'
@@ -138,7 +138,7 @@ describe('Request info', () => {
138
138
139
139
describe ( 'Request info disabled for pull requests' , ( ) => {
140
140
beforeEach ( ( ) => {
141
- github . repos . getContent . andReturn ( Promise . resolve ( {
141
+ github . repos . getContents . andReturn ( Promise . resolve ( {
142
142
data : {
143
143
content : Buffer . from ( `requestInfoLabelToAdd: needs-more-info\nrequestInfoDefaultTitles:\n - readme.md\nrequestInfoReplyComment: >\n Reply comment\nrequestInfoOn:\n issue: true\n pullRequest: false\n` ) . toString ( 'base64' )
144
144
}
@@ -149,7 +149,7 @@ describe('Request info', () => {
149
149
it ( "'pullRequest' type is disabled even if there wasn't enough info provided" , async ( ) => {
150
150
await app . receive ( prSuccessEvent )
151
151
152
- expect ( github . repos . getContent ) . toHaveBeenCalledWith ( {
152
+ expect ( github . repos . getContents ) . toHaveBeenCalledWith ( {
153
153
owner : 'hiimbex' ,
154
154
repo : 'testing-things' ,
155
155
path : '.github/config.yml'
@@ -164,7 +164,7 @@ describe('Request info', () => {
164
164
it ( 'there was a body in pr' , async ( ) => {
165
165
await app . receive ( prFailEvent )
166
166
167
- expect ( github . repos . getContent ) . toHaveBeenCalledWith ( {
167
+ expect ( github . repos . getContents ) . toHaveBeenCalledWith ( {
168
168
owner : 'hiimbex' ,
169
169
repo : 'testing-things' ,
170
170
path : '.github/config.yml'
@@ -179,7 +179,7 @@ describe('Request info', () => {
179
179
it ( 'there wasn\'t enough info provided (issue type still working)' , async ( ) => {
180
180
await app . receive ( issueSuccessEvent )
181
181
182
- expect ( github . repos . getContent ) . toHaveBeenCalledWith ( {
182
+ expect ( github . repos . getContents ) . toHaveBeenCalledWith ( {
183
183
owner : 'hiimbex' ,
184
184
repo : 'testing-things' ,
185
185
path : '.github/config.yml'
@@ -193,7 +193,7 @@ describe('Request info', () => {
193
193
194
194
describe ( 'Request info for random comment' , ( ) => {
195
195
beforeEach ( ( ) => {
196
- github . repos . getContent . andReturn ( Promise . resolve ( {
196
+ github . repos . getContents . andReturn ( Promise . resolve ( {
197
197
data : {
198
198
content : Buffer . from ( `requestInfoReplyComment:\n - Reply comment\n - Other reply comment` ) . toString ( 'base64' )
199
199
}
@@ -204,7 +204,7 @@ describe('Request info', () => {
204
204
it ( 'selects a random comment and posts it' , async ( ) => {
205
205
await app . receive ( prSuccessEvent )
206
206
207
- expect ( github . repos . getContent ) . toHaveBeenCalledWith ( {
207
+ expect ( github . repos . getContents ) . toHaveBeenCalledWith ( {
208
208
owner : 'hiimbex' ,
209
209
repo : 'testing-things' ,
210
210
path : '.github/config.yml'
@@ -218,7 +218,7 @@ describe('Request info', () => {
218
218
219
219
describe ( 'Request info for excluded user' , ( ) => {
220
220
beforeEach ( ( ) => {
221
- github . repos . getContent . andReturn ( Promise . resolve ( {
221
+ github . repos . getContents . andReturn ( Promise . resolve ( {
222
222
data : {
223
223
content : Buffer . from ( `requestInfoUserstoExclude:\n - hiimbex\n - bexo` ) . toString ( 'base64' )
224
224
}
@@ -229,7 +229,7 @@ describe('Request info', () => {
229
229
it ( 'selects a random comment and posts it' , async ( ) => {
230
230
await app . receive ( prSuccessEvent )
231
231
232
- expect ( github . repos . getContent ) . toHaveBeenCalledWith ( {
232
+ expect ( github . repos . getContents ) . toHaveBeenCalledWith ( {
233
233
owner : 'hiimbex' ,
234
234
repo : 'testing-things' ,
235
235
path : '.github/config.yml'
@@ -244,7 +244,7 @@ describe('Request info', () => {
244
244
describe ( 'Request info based on Pull Request template' , ( ) => {
245
245
describe ( 'If the setting is set to true' , ( ) => {
246
246
beforeEach ( ( ) => {
247
- github . repos . getContent . andCall ( ( { path} ) => {
247
+ github . repos . getContents . andCall ( ( { path} ) => {
248
248
if ( path === '.github/PULL_REQUEST_TEMPLATE.md' ) {
249
249
return Promise . resolve ( {
250
250
data : {
@@ -264,7 +264,7 @@ describe('Request info', () => {
264
264
it ( 'Posts a comment when PR body is equal to template' , async ( ) => {
265
265
await app . receive ( prTemplateBodyEvent )
266
266
267
- expect ( github . repos . getContent ) . toHaveBeenCalledWith ( {
267
+ expect ( github . repos . getContents ) . toHaveBeenCalledWith ( {
268
268
owner : 'hiimbex' ,
269
269
repo : 'testing-things' ,
270
270
path : '.github/config.yml'
@@ -276,7 +276,7 @@ describe('Request info', () => {
276
276
it ( 'Does not post a comment when PR body is different from template' , async ( ) => {
277
277
await app . receive ( prFailEvent )
278
278
279
- expect ( github . repos . getContent ) . toHaveBeenCalledWith ( {
279
+ expect ( github . repos . getContents ) . toHaveBeenCalledWith ( {
280
280
owner : 'hiimbex' ,
281
281
repo : 'testing-things' ,
282
282
path : '.github/config.yml'
@@ -288,7 +288,7 @@ describe('Request info', () => {
288
288
289
289
describe ( 'If the setting is set to false' , ( ) => {
290
290
beforeEach ( ( ) => {
291
- github . repos . getContent . andCall ( ( { path} ) => {
291
+ github . repos . getContents . andCall ( ( { path} ) => {
292
292
if ( path === '.github/PULL_REQUEST_TEMPLATE.md' ) {
293
293
return Promise . resolve ( {
294
294
data : {
@@ -308,7 +308,7 @@ describe('Request info', () => {
308
308
it ( 'Does not post a comment when PR body is equal to template' , async ( ) => {
309
309
await app . receive ( prTemplateBodyEvent )
310
310
311
- expect ( github . repos . getContent ) . toHaveBeenCalledWith ( {
311
+ expect ( github . repos . getContents ) . toHaveBeenCalledWith ( {
312
312
owner : 'hiimbex' ,
313
313
repo : 'testing-things' ,
314
314
path : '.github/config.yml'
@@ -320,7 +320,7 @@ describe('Request info', () => {
320
320
it ( 'Does not post a comment when PR body is different from template' , async ( ) => {
321
321
await app . receive ( prFailEvent )
322
322
323
- expect ( github . repos . getContent ) . toHaveBeenCalledWith ( {
323
+ expect ( github . repos . getContents ) . toHaveBeenCalledWith ( {
324
324
owner : 'hiimbex' ,
325
325
repo : 'testing-things' ,
326
326
path : '.github/config.yml'
@@ -334,7 +334,7 @@ describe('Request info', () => {
334
334
describe ( 'Request info based on issue template' , ( ) => {
335
335
describe ( 'If the setting is set to false' , ( ) => {
336
336
beforeEach ( ( ) => {
337
- github . repos . getContent . andCall ( ( { path} ) => {
337
+ github . repos . getContents . andCall ( ( { path} ) => {
338
338
return Promise . resolve ( {
339
339
data : {
340
340
content : Buffer . from ( `checkIssueTemplate: false` ) . toString ( 'base64' )
@@ -346,7 +346,7 @@ describe('Request info', () => {
346
346
it ( 'posts a message when issue body is empty' , async ( ) => {
347
347
await app . receive ( issueSuccessEvent )
348
348
349
- expect ( github . repos . getContent ) . toHaveBeenCalledWith ( {
349
+ expect ( github . repos . getContents ) . toHaveBeenCalledWith ( {
350
350
owner : 'hiimbex' ,
351
351
repo : 'testing-things' ,
352
352
path : '.github/config.yml'
@@ -358,7 +358,7 @@ describe('Request info', () => {
358
358
it ( 'does not post a message when PR body has text' , async ( ) => {
359
359
await app . receive ( issueFailEvent )
360
360
361
- expect ( github . repos . getContent ) . toHaveBeenCalledWith ( {
361
+ expect ( github . repos . getContents ) . toHaveBeenCalledWith ( {
362
362
owner : 'hiimbex' ,
363
363
repo : 'testing-things' ,
364
364
path : '.github/config.yml'
@@ -371,7 +371,7 @@ describe('Request info', () => {
371
371
describe ( 'If the setting is set to true' , ( ) => {
372
372
describe ( 'And the user has no issue template defined' , ( ) => {
373
373
beforeEach ( ( ) => {
374
- github . repos . getContent . andCall ( ( { path} ) => {
374
+ github . repos . getContents . andCall ( ( { path} ) => {
375
375
if ( path === '.github/ISSUE_TEMPLATE.md' ) {
376
376
return Promise . reject ( new Error ( '404' ) )
377
377
}
@@ -387,7 +387,7 @@ describe('Request info', () => {
387
387
it ( 'posts a message when issue body is empty' , async ( ) => {
388
388
await app . receive ( issueSuccessEvent )
389
389
390
- expect ( github . repos . getContent ) . toHaveBeenCalledWith ( {
390
+ expect ( github . repos . getContents ) . toHaveBeenCalledWith ( {
391
391
owner : 'hiimbex' ,
392
392
repo : 'testing-things' ,
393
393
path : '.github/config.yml'
@@ -399,7 +399,7 @@ describe('Request info', () => {
399
399
it ( 'does not post a message when PR body has text' , async ( ) => {
400
400
await app . receive ( issueFailEvent )
401
401
402
- expect ( github . repos . getContent ) . toHaveBeenCalledWith ( {
402
+ expect ( github . repos . getContents ) . toHaveBeenCalledWith ( {
403
403
owner : 'hiimbex' ,
404
404
repo : 'testing-things' ,
405
405
path : '.github/config.yml'
@@ -411,7 +411,7 @@ describe('Request info', () => {
411
411
412
412
describe ( 'And the user has one template defined' , ( ) => {
413
413
beforeEach ( ( ) => {
414
- github . repos . getContent . andCall ( ( { path} ) => {
414
+ github . repos . getContents . andCall ( ( { path} ) => {
415
415
if ( path === '.github/ISSUE_TEMPLATE.md' ) {
416
416
return Promise . resolve ( {
417
417
data : {
@@ -431,7 +431,7 @@ describe('Request info', () => {
431
431
it ( 'posts a message when issue body is empty' , async ( ) => {
432
432
await app . receive ( issueSuccessEvent )
433
433
434
- expect ( github . repos . getContent ) . toHaveBeenCalledWith ( {
434
+ expect ( github . repos . getContents ) . toHaveBeenCalledWith ( {
435
435
owner : 'hiimbex' ,
436
436
repo : 'testing-things' ,
437
437
path : '.github/config.yml'
@@ -443,7 +443,7 @@ describe('Request info', () => {
443
443
it ( 'posts a message when issue body matches template' , async ( ) => {
444
444
await app . receive ( issueTemplateBodyEvent )
445
445
446
- expect ( github . repos . getContent ) . toHaveBeenCalledWith ( {
446
+ expect ( github . repos . getContents ) . toHaveBeenCalledWith ( {
447
447
owner : 'hiimbex' ,
448
448
repo : 'testing-things' ,
449
449
path : '.github/config.yml'
@@ -455,7 +455,7 @@ describe('Request info', () => {
455
455
it ( 'does not post a message when issue body is different to template' , async ( ) => {
456
456
await app . receive ( issueFailEvent )
457
457
458
- expect ( github . repos . getContent ) . toHaveBeenCalledWith ( {
458
+ expect ( github . repos . getContents ) . toHaveBeenCalledWith ( {
459
459
owner : 'hiimbex' ,
460
460
repo : 'testing-things' ,
461
461
path : '.github/config.yml'
@@ -467,7 +467,7 @@ describe('Request info', () => {
467
467
468
468
describe ( 'And the user has multiple templates defined' , ( ) => {
469
469
beforeEach ( ( ) => {
470
- github . repos . getContent . andCall ( ( { path} ) => {
470
+ github . repos . getContents . andCall ( ( { path} ) => {
471
471
if ( path === '.github/ISSUE_TEMPLATE.md' ) {
472
472
return Promise . reject ( new Error ( '404' ) )
473
473
}
@@ -514,7 +514,7 @@ describe('Request info', () => {
514
514
it ( 'posts a message when issue body is empty' , async ( ) => {
515
515
await app . receive ( issueSuccessEvent )
516
516
517
- expect ( github . repos . getContent ) . toHaveBeenCalledWith ( {
517
+ expect ( github . repos . getContents ) . toHaveBeenCalledWith ( {
518
518
owner : 'hiimbex' ,
519
519
repo : 'testing-things' ,
520
520
path : '.github/config.yml'
@@ -526,7 +526,7 @@ describe('Request info', () => {
526
526
it ( 'posts a message when issue body matches first template' , async ( ) => {
527
527
await app . receive ( issueFirstTemplateBodyEvent )
528
528
529
- expect ( github . repos . getContent ) . toHaveBeenCalledWith ( {
529
+ expect ( github . repos . getContents ) . toHaveBeenCalledWith ( {
530
530
owner : 'hiimbex' ,
531
531
repo : 'testing-things' ,
532
532
path : '.github/config.yml'
@@ -538,7 +538,7 @@ describe('Request info', () => {
538
538
it ( 'posts a message when issue body matches second template' , async ( ) => {
539
539
await app . receive ( issueSecondTemplateBodyEvent )
540
540
541
- expect ( github . repos . getContent ) . toHaveBeenCalledWith ( {
541
+ expect ( github . repos . getContents ) . toHaveBeenCalledWith ( {
542
542
owner : 'hiimbex' ,
543
543
repo : 'testing-things' ,
544
544
path : '.github/config.yml'
@@ -550,7 +550,7 @@ describe('Request info', () => {
550
550
it ( 'does not post a message when issue body is different to all templates' , async ( ) => {
551
551
await app . receive ( issueFailEvent )
552
552
553
- expect ( github . repos . getContent ) . toHaveBeenCalledWith ( {
553
+ expect ( github . repos . getContents ) . toHaveBeenCalledWith ( {
554
554
owner : 'hiimbex' ,
555
555
repo : 'testing-things' ,
556
556
path : '.github/config.yml'
0 commit comments