@@ -12,7 +12,7 @@ describe('s3', function() {
12
12
putObject : function ( params , cb ) {
13
13
cb ( ) ;
14
14
} ,
15
- getObject : function ( params , cb ) {
15
+ getObject : function ( params , cb ) {
16
16
cb ( new Error ( "File not found" ) ) ;
17
17
}
18
18
} ;
@@ -168,13 +168,13 @@ describe('s3', function() {
168
168
assert . match ( mockUi . messages [ 3 ] , / - ✔ j s - a p p \/ a p p \. c s s / ) ;
169
169
assert . match ( mockUi . messages [ 4 ] , / - ✔ j s - a p p \/ m a n i f e s t \. t x t / ) ;
170
170
done ( ) ;
171
- } ) . catch ( function ( reason ) {
171
+ } ) . catch ( function ( reason ) {
172
172
done ( reason ) ;
173
173
} ) ;
174
174
} ) ;
175
175
176
176
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 ) {
178
178
cb ( undefined , {
179
179
Body : "app.js"
180
180
} ) ;
@@ -197,7 +197,37 @@ describe('s3', function() {
197
197
assert . match ( mockUi . messages [ 2 ] , / - ✔ j s - a p p \/ a p p \. c s s / ) ;
198
198
assert . match ( mockUi . messages [ 3 ] , / - ✔ j s - a p p \/ m a n i f e s t \. t x t / ) ;
199
199
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 ) {
201
231
done ( reason ) ;
202
232
} ) ;
203
233
} ) ;
0 commit comments