@@ -18,6 +18,7 @@ const mockLoader = {
1818const initMockPushProcessors = ( sinon ) => {
1919 const mockPushProcessors = {
2020 parsePush : sinon . stub ( ) ,
21+ checkEmptyBranch : sinon . stub ( ) ,
2122 audit : sinon . stub ( ) ,
2223 checkRepoInAuthorisedList : sinon . stub ( ) ,
2324 checkCommitMessages : sinon . stub ( ) ,
@@ -33,9 +34,9 @@ const initMockPushProcessors = (sinon) => {
3334 clearBareClone : sinon . stub ( ) ,
3435 scanDiff : sinon . stub ( ) ,
3536 blockForAuth : sinon . stub ( ) ,
36- getMissingData : sinon . stub ( ) ,
3737 } ;
3838 mockPushProcessors . parsePush . displayName = 'parsePush' ;
39+ mockPushProcessors . checkEmptyBranch . displayName = 'checkEmptyBranch' ;
3940 mockPushProcessors . audit . displayName = 'audit' ;
4041 mockPushProcessors . checkRepoInAuthorisedList . displayName = 'checkRepoInAuthorisedList' ;
4142 mockPushProcessors . checkCommitMessages . displayName = 'checkCommitMessages' ;
@@ -51,7 +52,6 @@ const initMockPushProcessors = (sinon) => {
5152 mockPushProcessors . clearBareClone . displayName = 'clearBareClone' ;
5253 mockPushProcessors . scanDiff . displayName = 'scanDiff' ;
5354 mockPushProcessors . blockForAuth . displayName = 'blockForAuth' ;
54- mockPushProcessors . getMissingData . displayName = 'getMissingData' ;
5555 return mockPushProcessors ;
5656} ;
5757const mockPreProcessors = {
@@ -127,6 +127,7 @@ describe('proxy chain', function () {
127127 const continuingAction = { type : 'push' , continue : ( ) => true , allowPush : false } ;
128128 mockPreProcessors . parseAction . resolves ( { type : 'push' } ) ;
129129 mockPushProcessors . parsePush . resolves ( continuingAction ) ;
130+ mockPushProcessors . checkEmptyBranch . resolves ( continuingAction ) ;
130131 mockPushProcessors . checkRepoInAuthorisedList . resolves ( continuingAction ) ;
131132 mockPushProcessors . checkCommitMessages . resolves ( continuingAction ) ;
132133 mockPushProcessors . checkAuthorEmails . resolves ( continuingAction ) ;
@@ -152,7 +153,7 @@ describe('proxy chain', function () {
152153 expect ( mockPushProcessors . pullRemote . called ) . to . be . true ;
153154 expect ( mockPushProcessors . checkHiddenCommits . called ) . to . be . true ;
154155 expect ( mockPushProcessors . writePack . called ) . to . be . true ;
155- expect ( mockPushProcessors . getMissingData . called ) . to . be . false ;
156+ expect ( mockPushProcessors . checkEmptyBranch . called ) . to . be . true ;
156157 expect ( mockPushProcessors . audit . called ) . to . be . true ;
157158
158159 expect ( result . type ) . to . equal ( 'push' ) ;
@@ -165,6 +166,7 @@ describe('proxy chain', function () {
165166 const continuingAction = { type : 'push' , continue : ( ) => true , allowPush : false } ;
166167 mockPreProcessors . parseAction . resolves ( { type : 'push' } ) ;
167168 mockPushProcessors . parsePush . resolves ( continuingAction ) ;
169+ mockPushProcessors . checkEmptyBranch . resolves ( continuingAction ) ;
168170 mockPushProcessors . checkRepoInAuthorisedList . resolves ( continuingAction ) ;
169171 mockPushProcessors . checkCommitMessages . resolves ( continuingAction ) ;
170172 mockPushProcessors . checkAuthorEmails . resolves ( continuingAction ) ;
@@ -182,6 +184,7 @@ describe('proxy chain', function () {
182184
183185 expect ( mockPreProcessors . parseAction . called ) . to . be . true ;
184186 expect ( mockPushProcessors . parsePush . called ) . to . be . true ;
187+ expect ( mockPushProcessors . checkEmptyBranch . called ) . to . be . true ;
185188 expect ( mockPushProcessors . checkRepoInAuthorisedList . called ) . to . be . true ;
186189 expect ( mockPushProcessors . checkCommitMessages . called ) . to . be . true ;
187190 expect ( mockPushProcessors . checkAuthorEmails . called ) . to . be . true ;
@@ -190,7 +193,6 @@ describe('proxy chain', function () {
190193 expect ( mockPushProcessors . pullRemote . called ) . to . be . true ;
191194 expect ( mockPushProcessors . checkHiddenCommits . called ) . to . be . true ;
192195 expect ( mockPushProcessors . writePack . called ) . to . be . true ;
193- expect ( mockPushProcessors . getMissingData . called ) . to . be . false ;
194196 expect ( mockPushProcessors . audit . called ) . to . be . true ;
195197
196198 expect ( result . type ) . to . equal ( 'push' ) ;
@@ -203,6 +205,7 @@ describe('proxy chain', function () {
203205 const continuingAction = { type : 'push' , continue : ( ) => true , allowPush : false } ;
204206 mockPreProcessors . parseAction . resolves ( { type : 'push' } ) ;
205207 mockPushProcessors . parsePush . resolves ( continuingAction ) ;
208+ mockPushProcessors . checkEmptyBranch . resolves ( continuingAction ) ;
206209 mockPushProcessors . checkRepoInAuthorisedList . resolves ( continuingAction ) ;
207210 mockPushProcessors . checkCommitMessages . resolves ( continuingAction ) ;
208211 mockPushProcessors . checkAuthorEmails . resolves ( continuingAction ) ;
@@ -217,12 +220,12 @@ describe('proxy chain', function () {
217220 mockPushProcessors . clearBareClone . resolves ( continuingAction ) ;
218221 mockPushProcessors . scanDiff . resolves ( continuingAction ) ;
219222 mockPushProcessors . blockForAuth . resolves ( continuingAction ) ;
220- mockPushProcessors . getMissingData . resolves ( continuingAction ) ;
221223
222224 const result = await chain . executeChain ( req ) ;
223225
224226 expect ( mockPreProcessors . parseAction . called ) . to . be . true ;
225227 expect ( mockPushProcessors . parsePush . called ) . to . be . true ;
228+ expect ( mockPushProcessors . checkEmptyBranch . called ) . to . be . true ;
226229 expect ( mockPushProcessors . checkRepoInAuthorisedList . called ) . to . be . true ;
227230 expect ( mockPushProcessors . checkCommitMessages . called ) . to . be . true ;
228231 expect ( mockPushProcessors . checkAuthorEmails . called ) . to . be . true ;
@@ -238,7 +241,6 @@ describe('proxy chain', function () {
238241 expect ( mockPushProcessors . scanDiff . called ) . to . be . true ;
239242 expect ( mockPushProcessors . blockForAuth . called ) . to . be . true ;
240243 expect ( mockPushProcessors . audit . called ) . to . be . true ;
241- expect ( mockPushProcessors . getMissingData . called ) . to . be . true ;
242244
243245 expect ( result . type ) . to . equal ( 'push' ) ;
244246 expect ( result . allowPush ) . to . be . false ;
@@ -299,6 +301,7 @@ describe('proxy chain', function () {
299301
300302 mockPreProcessors . parseAction . resolves ( action ) ;
301303 mockPushProcessors . parsePush . resolves ( action ) ;
304+ mockPushProcessors . checkEmptyBranch . resolves ( action ) ;
302305 mockPushProcessors . checkRepoInAuthorisedList . resolves ( action ) ;
303306 mockPushProcessors . checkCommitMessages . resolves ( action ) ;
304307 mockPushProcessors . checkAuthorEmails . resolves ( action ) ;
@@ -320,7 +323,6 @@ describe('proxy chain', function () {
320323 mockPushProcessors . clearBareClone . resolves ( action ) ;
321324 mockPushProcessors . scanDiff . resolves ( action ) ;
322325 mockPushProcessors . blockForAuth . resolves ( action ) ;
323- mockPushProcessors . getMissingData . resolves ( action ) ;
324326 const dbStub = sinon . stub ( db , 'authorise' ) . resolves ( true ) ;
325327
326328 const result = await chain . executeChain ( req ) ;
@@ -347,6 +349,7 @@ describe('proxy chain', function () {
347349
348350 mockPreProcessors . parseAction . resolves ( action ) ;
349351 mockPushProcessors . parsePush . resolves ( action ) ;
352+ mockPushProcessors . checkEmptyBranch . resolves ( action ) ;
350353 mockPushProcessors . checkRepoInAuthorisedList . resolves ( action ) ;
351354 mockPushProcessors . checkCommitMessages . resolves ( action ) ;
352355 mockPushProcessors . checkAuthorEmails . resolves ( action ) ;
@@ -368,7 +371,6 @@ describe('proxy chain', function () {
368371 mockPushProcessors . clearBareClone . resolves ( action ) ;
369372 mockPushProcessors . scanDiff . resolves ( action ) ;
370373 mockPushProcessors . blockForAuth . resolves ( action ) ;
371- mockPushProcessors . getMissingData . resolves ( action ) ;
372374
373375 const dbStub = sinon . stub ( db , 'reject' ) . resolves ( true ) ;
374376
@@ -396,6 +398,7 @@ describe('proxy chain', function () {
396398
397399 mockPreProcessors . parseAction . resolves ( action ) ;
398400 mockPushProcessors . parsePush . resolves ( action ) ;
401+ mockPushProcessors . checkEmptyBranch . resolves ( action ) ;
399402 mockPushProcessors . checkRepoInAuthorisedList . resolves ( action ) ;
400403 mockPushProcessors . checkCommitMessages . resolves ( action ) ;
401404 mockPushProcessors . checkAuthorEmails . resolves ( action ) ;
@@ -417,7 +420,6 @@ describe('proxy chain', function () {
417420 mockPushProcessors . clearBareClone . resolves ( action ) ;
418421 mockPushProcessors . scanDiff . resolves ( action ) ;
419422 mockPushProcessors . blockForAuth . resolves ( action ) ;
420- mockPushProcessors . getMissingData . resolves ( action ) ;
421423
422424 const error = new Error ( 'Database error' ) ;
423425
@@ -444,6 +446,7 @@ describe('proxy chain', function () {
444446
445447 mockPreProcessors . parseAction . resolves ( action ) ;
446448 mockPushProcessors . parsePush . resolves ( action ) ;
449+ mockPushProcessors . checkEmptyBranch . resolves ( action ) ;
447450 mockPushProcessors . checkRepoInAuthorisedList . resolves ( action ) ;
448451 mockPushProcessors . checkCommitMessages . resolves ( action ) ;
449452 mockPushProcessors . checkAuthorEmails . resolves ( action ) ;
@@ -465,7 +468,6 @@ describe('proxy chain', function () {
465468 mockPushProcessors . clearBareClone . resolves ( action ) ;
466469 mockPushProcessors . scanDiff . resolves ( action ) ;
467470 mockPushProcessors . blockForAuth . resolves ( action ) ;
468- mockPushProcessors . getMissingData . resolves ( action ) ;
469471
470472 const error = new Error ( 'Database error' ) ;
471473
0 commit comments