@@ -12,7 +12,7 @@ describe('s3', function() {
1212 putObject : function ( params , cb ) {
1313 cb ( ) ;
1414 } ,
15- getObject : function ( params , cb ) {
15+ getObject : function ( params , cb ) {
1616 cb ( new Error ( "File not found" ) ) ;
1717 }
1818 } ;
@@ -168,13 +168,13 @@ describe('s3', function() {
168168 assert . match ( mockUi . messages [ 3 ] , / - ✔ j s - a p p \/ a p p \. c s s / ) ;
169169 assert . match ( mockUi . messages [ 4 ] , / - ✔ j s - a p p \/ m a n i f e s t \. t x t / ) ;
170170 done ( ) ;
171- } ) . catch ( function ( reason ) {
171+ } ) . catch ( function ( reason ) {
172172 done ( reason ) ;
173173 } ) ;
174174 } ) ;
175175
176176 it ( 'only uploads missing files when manifest is present on server' , function ( done ) {
177- s3Client . getObject = function ( params , cb ) {
177+ s3Client . getObject = function ( params , cb ) {
178178 cb ( undefined , {
179179 Body : "app.js"
180180 } ) ;
@@ -197,7 +197,37 @@ describe('s3', function() {
197197 assert . match ( mockUi . messages [ 2 ] , / - ✔ j s - a p p \/ a p p \. c s s / ) ;
198198 assert . match ( mockUi . messages [ 3 ] , / - ✔ j s - a p p \/ m a n i f e s t \. t x t / ) ;
199199 done ( ) ;
200- } ) . catch ( function ( reason ) {
200+ } ) . catch ( function ( reason ) {
201+ done ( reason ) ;
202+ } ) ;
203+ } ) ;
204+
205+ it ( 'does not upload manifest.txt when one of the files does not succeed uploading' , function ( done ) {
206+ s3Client . putObject = function ( params , cb ) {
207+ if ( params . Key === 'js-app/app.css' ) {
208+ cb ( 'error uploading' ) ;
209+ } else {
210+ cb ( ) ;
211+ }
212+ } ;
213+
214+ var options = {
215+ filePaths : [ 'app.js' , 'app.css' ] ,
216+ cwd : process . cwd ( ) + '/tests/fixtures/dist' ,
217+ prefix : 'js-app' ,
218+ manifestPath : 'manifest.txt'
219+ } ;
220+
221+ var promise = subject . upload ( options ) ;
222+
223+ return assert . isRejected ( promise )
224+ . then ( function ( ) {
225+ assert . equal ( mockUi . messages . length , 3 ) ;
226+ assert . match ( mockUi . messages [ 0 ] , / - D o w n l o a d i n g m a n i f e s t f o r d i f f e r e n t i a l d e p l o y .../ ) ;
227+ assert . match ( mockUi . messages [ 1 ] , / - M a n i f e s t n o t f o u n d . D i s a b l i n g d i f f e r e n t i a l d e p l o y \. / ) ;
228+ assert . match ( mockUi . messages [ 2 ] , / - ✔ j s - a p p \/ a p p \. j s / ) ;
229+ done ( ) ;
230+ } ) . catch ( function ( reason ) {
201231 done ( reason ) ;
202232 } ) ;
203233 } ) ;
0 commit comments