File tree Expand file tree Collapse file tree 2 files changed +4
-18
lines changed Expand file tree Collapse file tree 2 files changed +4
-18
lines changed Original file line number Diff line number Diff line change @@ -116,25 +116,11 @@ describe(Upload.name, () => {
116116 } ;
117117
118118 it ( "uses the input parameters for object length if provided" , async ( ) => {
119- const falseFileStream = Object . assign ( Readable . from ( "abcd" ) , {
120- path : "/dev/null" ,
121- } ) ;
122119 let upload = new Upload ( {
123120 params : {
124121 Bucket : "" ,
125122 Key : "" ,
126- Body : falseFileStream ,
127- MpuObjectSize : 6 * 1024 * 1024 ,
128- } ,
129- client : s3MockInstance ,
130- } ) as unknown as VisibleForTesting ;
131- expect ( upload . totalBytes ) . toEqual ( 6 * 1024 * 1024 ) ;
132-
133- upload = new Upload ( {
134- params : {
135- Bucket : "" ,
136- Key : "" ,
137- Body : falseFileStream ,
123+ Body : Buffer . from ( "a" . repeat ( 256 ) ) ,
138124 ContentLength : 6 * 1024 * 1024 ,
139125 } ,
140126 client : s3MockInstance ,
@@ -145,11 +131,11 @@ describe(Upload.name, () => {
145131 params : {
146132 Bucket : "" ,
147133 Key : "" ,
148- Body : falseFileStream ,
134+ Body : Buffer . from ( "a" . repeat ( 256 ) ) ,
149135 } ,
150136 client : s3MockInstance ,
151137 } ) as unknown as VisibleForTesting ;
152- expect ( upload . totalBytes ) . toEqual ( 0 ) ;
138+ expect ( upload . totalBytes ) . toEqual ( 256 ) ;
153139 } ) ;
154140
155141 it ( "correctly exposes the event emitter API" , ( ) => {
Original file line number Diff line number Diff line change @@ -97,7 +97,7 @@ export class Upload extends EventEmitter {
9797 }
9898
9999 // set progress defaults
100- this . totalBytes = this . params . MpuObjectSize ?? this . params . ContentLength ?? byteLength ( this . params . Body ) ;
100+ this . totalBytes = this . params . ContentLength ?? byteLength ( this . params . Body ) ;
101101 this . bytesUploadedSoFar = 0 ;
102102 this . abortController = options . abortController ?? new AbortController ( ) ;
103103
You can’t perform that action at this time.
0 commit comments