@@ -248,10 +248,10 @@ describe('S3Adapter tests', () => {
248248 it ( 'should handle range bytes' , ( ) => {
249249 const s3 = new S3Adapter ( 'accessKey' , 'secretKey' , 'my-bucket' ) ;
250250 const s3ClientMock = jasmine . createSpyObj ( 'S3Client' , [ 'send' ] ) ;
251- const returnedData = {
252- Body : { transformToWebStream : ( ) => Buffer . from ( 'hello world' , 'utf8' ) }
253- }
254- s3ClientMock . send . and . returnValue ( Promise . resolve ( returnedData ) ) ;
251+ const stream = new Readable ( ) ;
252+ stream . push ( 'hello world' ) ;
253+ stream . push ( null ) ;
254+ s3ClientMock . send . and . returnValue ( Promise . resolve ( { Body : stream } ) ) ;
255255 s3 . _s3Client = s3ClientMock ;
256256
257257 const req = {
@@ -297,10 +297,9 @@ describe('S3Adapter tests', () => {
297297 it ( 'should handle range bytes no data' , ( ) => {
298298 const s3 = new S3Adapter ( 'accessKey' , 'secretKey' , 'my-bucket' ) ;
299299 const s3ClientMock = jasmine . createSpyObj ( 'S3Client' , [ 'send' ] ) ;
300- s3ClientMock . send . and . returnValue ( Promise . resolve ( ) ) ;
300+ s3ClientMock . send . and . returnValue ( Promise . resolve ( { } ) ) ;
301301 s3 . _s3Client = s3ClientMock ;
302302
303- const data = { Error : 'NoBody' } ;
304303 const req = {
305304 get : ( ) => 'bytes=0-1' ,
306305 } ;
@@ -310,7 +309,7 @@ describe('S3Adapter tests', () => {
310309 end : jasmine . createSpy ( 'end' ) ,
311310 } ;
312311 s3 . handleFileStream ( 'test.mov' , req , resp ) . catch ( ( error ) => {
313- expect ( error ) . toBe ( data ) ;
312+ expect ( error . message ) . toBe ( 'S3 object body is missing.' ) ;
314313 expect ( resp . writeHead ) . not . toHaveBeenCalled ( ) ;
315314 expect ( resp . write ) . not . toHaveBeenCalled ( ) ;
316315 expect ( resp . end ) . not . toHaveBeenCalled ( ) ;
0 commit comments