@@ -2,6 +2,7 @@ const chai = require('chai');
22const sinon = require ( 'sinon' ) ;
33const { PluginLoader } = require ( '../src/plugin' ) ;
44
5+
56chai . should ( ) ;
67const expect = chai . expect ;
78
@@ -26,6 +27,7 @@ const mockPushProcessors = {
2627 writePack : sinon . stub ( ) ,
2728 getDiff : sinon . stub ( ) ,
2829 clearBareClone : sinon . stub ( ) ,
30+ checkExifJpeg : sinon . stub ( ) ,
2931 scanDiff : sinon . stub ( ) ,
3032 blockForAuth : sinon . stub ( ) ,
3133} ;
@@ -39,6 +41,7 @@ mockPushProcessors.checkIfWaitingAuth.displayName = 'checkIfWaitingAuth';
3941mockPushProcessors . pullRemote . displayName = 'pullRemote' ;
4042mockPushProcessors . writePack . displayName = 'writePack' ;
4143mockPushProcessors . getDiff . displayName = 'getDiff' ;
44+ mockPushProcessors . checkEXIFJpeg . displayName = 'checkEXIFJpeg' ;
4245mockPushProcessors . clearBareClone . displayName = 'clearBareClone' ;
4346mockPushProcessors . scanDiff . displayName = 'scanDiff' ;
4447mockPushProcessors . blockForAuth . displayName = 'blockForAuth' ;
@@ -104,6 +107,7 @@ describe('proxy chain', function () {
104107 mockPushProcessors . parsePush . resolves ( continuingAction ) ;
105108 mockPushProcessors . checkRepoInAuthorisedList . resolves ( continuingAction ) ;
106109 mockPushProcessors . checkCommitMessages . resolves ( continuingAction ) ;
110+ mockPushProcessors . checkEXIFJpeg . resolves ( continuingAction ) ;
107111 mockPushProcessors . checkAuthorEmails . resolves ( continuingAction ) ;
108112 mockPushProcessors . checkUserPushPermission . resolves ( continuingAction ) ;
109113
@@ -120,6 +124,7 @@ describe('proxy chain', function () {
120124 expect ( mockPushProcessors . checkIfWaitingAuth . called ) . to . be . true ;
121125 expect ( mockPushProcessors . pullRemote . called ) . to . be . false ;
122126 expect ( mockPushProcessors . audit . called ) . to . be . true ;
127+ expect ( mockPushProcessors . checkEXIFJpeg . called ) . to . be . false ;
123128
124129 expect ( result . type ) . to . equal ( 'push' ) ;
125130 expect ( result . allowPush ) . to . be . false ;
@@ -135,7 +140,9 @@ describe('proxy chain', function () {
135140 mockPushProcessors . checkCommitMessages . resolves ( continuingAction ) ;
136141 mockPushProcessors . checkAuthorEmails . resolves ( continuingAction ) ;
137142 mockPushProcessors . checkUserPushPermission . resolves ( continuingAction ) ;
143+ mockPushProcessors . checkEXIFJpeg . resolves ( continuingAction ) ;
138144 // this stops the chain from further execution
145+
139146 mockPushProcessors . checkIfWaitingAuth . resolves ( { type : 'push' , continue : ( ) => true , allowPush : true } ) ;
140147 const result = await chain . executeChain ( req ) ;
141148
@@ -148,6 +155,7 @@ describe('proxy chain', function () {
148155 expect ( mockPushProcessors . checkIfWaitingAuth . called ) . to . be . true ;
149156 expect ( mockPushProcessors . pullRemote . called ) . to . be . false ;
150157 expect ( mockPushProcessors . audit . called ) . to . be . true ;
158+ expect ( mockPushProcessors . checkEXIFJpeg . called ) . to . be . false ;
151159
152160 expect ( result . type ) . to . equal ( 'push' ) ;
153161 expect ( result . allowPush ) . to . be . true ;
@@ -167,9 +175,11 @@ describe('proxy chain', function () {
167175 mockPushProcessors . pullRemote . resolves ( continuingAction ) ;
168176 mockPushProcessors . writePack . resolves ( continuingAction ) ;
169177 mockPushProcessors . getDiff . resolves ( continuingAction ) ;
178+ mockPushProcessors . checkEXIFJpeg . resolves ( continuingAction ) ;
170179 mockPushProcessors . clearBareClone . resolves ( continuingAction ) ;
171180 mockPushProcessors . scanDiff . resolves ( continuingAction ) ;
172181 mockPushProcessors . blockForAuth . resolves ( continuingAction ) ;
182+
173183
174184 const result = await chain . executeChain ( req ) ;
175185
@@ -183,6 +193,7 @@ describe('proxy chain', function () {
183193 expect ( mockPushProcessors . pullRemote . called ) . to . be . true ;
184194 expect ( mockPushProcessors . writePack . called ) . to . be . true ;
185195 expect ( mockPushProcessors . getDiff . called ) . to . be . true ;
196+ expect ( mockPushProcessors . checkEXIFJpeg . called ) . to . be . true ;
186197 expect ( mockPushProcessors . clearBareClone . called ) . to . be . true ;
187198 expect ( mockPushProcessors . scanDiff . called ) . to . be . true ;
188199 expect ( mockPushProcessors . blockForAuth . called ) . to . be . true ;
0 commit comments