@@ -18,6 +18,7 @@ const mockLoader = {
18
18
const initMockPushProcessors = ( sinon ) => {
19
19
const mockPushProcessors = {
20
20
parsePush : sinon . stub ( ) ,
21
+ checkEmptyBranch : sinon . stub ( ) ,
21
22
audit : sinon . stub ( ) ,
22
23
checkRepoInAuthorisedList : sinon . stub ( ) ,
23
24
checkCommitMessages : sinon . stub ( ) ,
@@ -33,9 +34,9 @@ const initMockPushProcessors = (sinon) => {
33
34
clearBareClone : sinon . stub ( ) ,
34
35
scanDiff : sinon . stub ( ) ,
35
36
blockForAuth : sinon . stub ( ) ,
36
- getMissingData : sinon . stub ( ) ,
37
37
} ;
38
38
mockPushProcessors . parsePush . displayName = 'parsePush' ;
39
+ mockPushProcessors . checkEmptyBranch . displayName = 'checkEmptyBranch' ;
39
40
mockPushProcessors . audit . displayName = 'audit' ;
40
41
mockPushProcessors . checkRepoInAuthorisedList . displayName = 'checkRepoInAuthorisedList' ;
41
42
mockPushProcessors . checkCommitMessages . displayName = 'checkCommitMessages' ;
@@ -51,7 +52,6 @@ const initMockPushProcessors = (sinon) => {
51
52
mockPushProcessors . clearBareClone . displayName = 'clearBareClone' ;
52
53
mockPushProcessors . scanDiff . displayName = 'scanDiff' ;
53
54
mockPushProcessors . blockForAuth . displayName = 'blockForAuth' ;
54
- mockPushProcessors . getMissingData . displayName = 'getMissingData' ;
55
55
return mockPushProcessors ;
56
56
} ;
57
57
const mockPreProcessors = {
@@ -127,6 +127,7 @@ describe('proxy chain', function () {
127
127
const continuingAction = { type : 'push' , continue : ( ) => true , allowPush : false } ;
128
128
mockPreProcessors . parseAction . resolves ( { type : 'push' } ) ;
129
129
mockPushProcessors . parsePush . resolves ( continuingAction ) ;
130
+ mockPushProcessors . checkEmptyBranch . resolves ( continuingAction ) ;
130
131
mockPushProcessors . checkRepoInAuthorisedList . resolves ( continuingAction ) ;
131
132
mockPushProcessors . checkCommitMessages . resolves ( continuingAction ) ;
132
133
mockPushProcessors . checkAuthorEmails . resolves ( continuingAction ) ;
@@ -152,7 +153,7 @@ describe('proxy chain', function () {
152
153
expect ( mockPushProcessors . pullRemote . called ) . to . be . true ;
153
154
expect ( mockPushProcessors . checkHiddenCommits . called ) . to . be . true ;
154
155
expect ( mockPushProcessors . writePack . called ) . to . be . true ;
155
- expect ( mockPushProcessors . getMissingData . called ) . to . be . false ;
156
+ expect ( mockPushProcessors . checkEmptyBranch . called ) . to . be . true ;
156
157
expect ( mockPushProcessors . audit . called ) . to . be . true ;
157
158
158
159
expect ( result . type ) . to . equal ( 'push' ) ;
@@ -165,6 +166,7 @@ describe('proxy chain', function () {
165
166
const continuingAction = { type : 'push' , continue : ( ) => true , allowPush : false } ;
166
167
mockPreProcessors . parseAction . resolves ( { type : 'push' } ) ;
167
168
mockPushProcessors . parsePush . resolves ( continuingAction ) ;
169
+ mockPushProcessors . checkEmptyBranch . resolves ( continuingAction ) ;
168
170
mockPushProcessors . checkRepoInAuthorisedList . resolves ( continuingAction ) ;
169
171
mockPushProcessors . checkCommitMessages . resolves ( continuingAction ) ;
170
172
mockPushProcessors . checkAuthorEmails . resolves ( continuingAction ) ;
@@ -182,6 +184,7 @@ describe('proxy chain', function () {
182
184
183
185
expect ( mockPreProcessors . parseAction . called ) . to . be . true ;
184
186
expect ( mockPushProcessors . parsePush . called ) . to . be . true ;
187
+ expect ( mockPushProcessors . checkEmptyBranch . called ) . to . be . true ;
185
188
expect ( mockPushProcessors . checkRepoInAuthorisedList . called ) . to . be . true ;
186
189
expect ( mockPushProcessors . checkCommitMessages . called ) . to . be . true ;
187
190
expect ( mockPushProcessors . checkAuthorEmails . called ) . to . be . true ;
@@ -190,7 +193,6 @@ describe('proxy chain', function () {
190
193
expect ( mockPushProcessors . pullRemote . called ) . to . be . true ;
191
194
expect ( mockPushProcessors . checkHiddenCommits . called ) . to . be . true ;
192
195
expect ( mockPushProcessors . writePack . called ) . to . be . true ;
193
- expect ( mockPushProcessors . getMissingData . called ) . to . be . false ;
194
196
expect ( mockPushProcessors . audit . called ) . to . be . true ;
195
197
196
198
expect ( result . type ) . to . equal ( 'push' ) ;
@@ -203,6 +205,7 @@ describe('proxy chain', function () {
203
205
const continuingAction = { type : 'push' , continue : ( ) => true , allowPush : false } ;
204
206
mockPreProcessors . parseAction . resolves ( { type : 'push' } ) ;
205
207
mockPushProcessors . parsePush . resolves ( continuingAction ) ;
208
+ mockPushProcessors . checkEmptyBranch . resolves ( continuingAction ) ;
206
209
mockPushProcessors . checkRepoInAuthorisedList . resolves ( continuingAction ) ;
207
210
mockPushProcessors . checkCommitMessages . resolves ( continuingAction ) ;
208
211
mockPushProcessors . checkAuthorEmails . resolves ( continuingAction ) ;
@@ -217,12 +220,12 @@ describe('proxy chain', function () {
217
220
mockPushProcessors . clearBareClone . resolves ( continuingAction ) ;
218
221
mockPushProcessors . scanDiff . resolves ( continuingAction ) ;
219
222
mockPushProcessors . blockForAuth . resolves ( continuingAction ) ;
220
- mockPushProcessors . getMissingData . resolves ( continuingAction ) ;
221
223
222
224
const result = await chain . executeChain ( req ) ;
223
225
224
226
expect ( mockPreProcessors . parseAction . called ) . to . be . true ;
225
227
expect ( mockPushProcessors . parsePush . called ) . to . be . true ;
228
+ expect ( mockPushProcessors . checkEmptyBranch . called ) . to . be . true ;
226
229
expect ( mockPushProcessors . checkRepoInAuthorisedList . called ) . to . be . true ;
227
230
expect ( mockPushProcessors . checkCommitMessages . called ) . to . be . true ;
228
231
expect ( mockPushProcessors . checkAuthorEmails . called ) . to . be . true ;
@@ -238,7 +241,6 @@ describe('proxy chain', function () {
238
241
expect ( mockPushProcessors . scanDiff . called ) . to . be . true ;
239
242
expect ( mockPushProcessors . blockForAuth . called ) . to . be . true ;
240
243
expect ( mockPushProcessors . audit . called ) . to . be . true ;
241
- expect ( mockPushProcessors . getMissingData . called ) . to . be . true ;
242
244
243
245
expect ( result . type ) . to . equal ( 'push' ) ;
244
246
expect ( result . allowPush ) . to . be . false ;
@@ -299,6 +301,7 @@ describe('proxy chain', function () {
299
301
300
302
mockPreProcessors . parseAction . resolves ( action ) ;
301
303
mockPushProcessors . parsePush . resolves ( action ) ;
304
+ mockPushProcessors . checkEmptyBranch . resolves ( action ) ;
302
305
mockPushProcessors . checkRepoInAuthorisedList . resolves ( action ) ;
303
306
mockPushProcessors . checkCommitMessages . resolves ( action ) ;
304
307
mockPushProcessors . checkAuthorEmails . resolves ( action ) ;
@@ -320,7 +323,6 @@ describe('proxy chain', function () {
320
323
mockPushProcessors . clearBareClone . resolves ( action ) ;
321
324
mockPushProcessors . scanDiff . resolves ( action ) ;
322
325
mockPushProcessors . blockForAuth . resolves ( action ) ;
323
- mockPushProcessors . getMissingData . resolves ( action ) ;
324
326
const dbStub = sinon . stub ( db , 'authorise' ) . resolves ( true ) ;
325
327
326
328
const result = await chain . executeChain ( req ) ;
@@ -347,6 +349,7 @@ describe('proxy chain', function () {
347
349
348
350
mockPreProcessors . parseAction . resolves ( action ) ;
349
351
mockPushProcessors . parsePush . resolves ( action ) ;
352
+ mockPushProcessors . checkEmptyBranch . resolves ( action ) ;
350
353
mockPushProcessors . checkRepoInAuthorisedList . resolves ( action ) ;
351
354
mockPushProcessors . checkCommitMessages . resolves ( action ) ;
352
355
mockPushProcessors . checkAuthorEmails . resolves ( action ) ;
@@ -368,7 +371,6 @@ describe('proxy chain', function () {
368
371
mockPushProcessors . clearBareClone . resolves ( action ) ;
369
372
mockPushProcessors . scanDiff . resolves ( action ) ;
370
373
mockPushProcessors . blockForAuth . resolves ( action ) ;
371
- mockPushProcessors . getMissingData . resolves ( action ) ;
372
374
373
375
const dbStub = sinon . stub ( db , 'reject' ) . resolves ( true ) ;
374
376
@@ -396,6 +398,7 @@ describe('proxy chain', function () {
396
398
397
399
mockPreProcessors . parseAction . resolves ( action ) ;
398
400
mockPushProcessors . parsePush . resolves ( action ) ;
401
+ mockPushProcessors . checkEmptyBranch . resolves ( action ) ;
399
402
mockPushProcessors . checkRepoInAuthorisedList . resolves ( action ) ;
400
403
mockPushProcessors . checkCommitMessages . resolves ( action ) ;
401
404
mockPushProcessors . checkAuthorEmails . resolves ( action ) ;
@@ -417,7 +420,6 @@ describe('proxy chain', function () {
417
420
mockPushProcessors . clearBareClone . resolves ( action ) ;
418
421
mockPushProcessors . scanDiff . resolves ( action ) ;
419
422
mockPushProcessors . blockForAuth . resolves ( action ) ;
420
- mockPushProcessors . getMissingData . resolves ( action ) ;
421
423
422
424
const error = new Error ( 'Database error' ) ;
423
425
@@ -444,6 +446,7 @@ describe('proxy chain', function () {
444
446
445
447
mockPreProcessors . parseAction . resolves ( action ) ;
446
448
mockPushProcessors . parsePush . resolves ( action ) ;
449
+ mockPushProcessors . checkEmptyBranch . resolves ( action ) ;
447
450
mockPushProcessors . checkRepoInAuthorisedList . resolves ( action ) ;
448
451
mockPushProcessors . checkCommitMessages . resolves ( action ) ;
449
452
mockPushProcessors . checkAuthorEmails . resolves ( action ) ;
@@ -465,7 +468,6 @@ describe('proxy chain', function () {
465
468
mockPushProcessors . clearBareClone . resolves ( action ) ;
466
469
mockPushProcessors . scanDiff . resolves ( action ) ;
467
470
mockPushProcessors . blockForAuth . resolves ( action ) ;
468
- mockPushProcessors . getMissingData . resolves ( action ) ;
469
471
470
472
const error = new Error ( 'Database error' ) ;
471
473
0 commit comments