@@ -331,6 +331,30 @@ describe('upload file', function() {
331331 expect ( success ) . not . toHaveBeenCalled ( ) ;
332332 } ) ;
333333
334+ it ( 'should fail on permanent test error' , function ( ) {
335+ flow . opts . testChunks = true ;
336+ flow . opts . chunkSize = 1 ;
337+ flow . opts . simultaneousUploads = 2 ;
338+ flow . opts . maxChunkRetries = 1 ;
339+ flow . opts . permanentErrors = [ 500 ] ;
340+
341+ var error = jasmine . createSpy ( 'error' ) ;
342+ var success = jasmine . createSpy ( 'success' ) ;
343+ var retry = jasmine . createSpy ( 'retry' ) ;
344+ flow . on ( 'fileError' , error ) ;
345+ flow . on ( 'fileSuccess' , success ) ;
346+ flow . on ( 'fileRetry' , retry ) ;
347+
348+ flow . addFile ( new Blob ( [ 'abc' ] ) ) ;
349+ flow . upload ( ) ;
350+ expect ( requests . length ) . toBe ( 2 ) ;
351+ requests [ 0 ] . respond ( 500 ) ;
352+ expect ( requests . length ) . toBe ( 2 ) ;
353+ expect ( error ) . toHaveBeenCalled ( ) ;
354+ expect ( retry ) . not . toHaveBeenCalled ( ) ;
355+ expect ( success ) . not . toHaveBeenCalled ( ) ;
356+ } ) ;
357+
334358 it ( 'should upload empty file' , function ( ) {
335359 var error = jasmine . createSpy ( 'error' ) ;
336360 var success = jasmine . createSpy ( 'success' ) ;
@@ -390,8 +414,6 @@ describe('upload file', function() {
390414 expect ( error ) . not . toHaveBeenCalled ( ) ;
391415 } ) ;
392416
393-
394-
395417 it ( 'should preprocess chunks and wait for preprocess to finish' , function ( ) {
396418 flow . opts . simultaneousUploads = 1 ;
397419 var preprocess = jasmine . createSpy ( 'preprocess' ) ;
0 commit comments