@@ -145,19 +145,6 @@ describe('Firebase Storage > Requests', () => {
145145
146146 const metadataContentType = 'application/json; charset=utf-8' ;
147147
148- function readBlob ( blob : Blob ) : Promise < string > {
149- const reader = new FileReader ( ) ;
150- reader . readAsText ( blob ) ;
151- return new Promise ( ( resolve , reject ) => {
152- reader . onload = ( ) => {
153- resolve ( reader . result as string ) ;
154- } ;
155- reader . onerror = ( ) => {
156- reject ( reader . error as Error ) ;
157- } ;
158- } ) ;
159- }
160-
161148 async function assertBodyEquals (
162149 body : Blob | string | Uint8Array | null ,
163150 expectedStr : string
@@ -167,9 +154,14 @@ describe('Firebase Storage > Requests', () => {
167154 }
168155
169156 if ( typeof Blob !== 'undefined' && body instanceof Blob ) {
170- return readBlob ( body ) . then ( str => {
171- assert . equal ( str , expectedStr ) ;
172- } ) ;
157+ return body
158+ . text ( )
159+ . then ( str => {
160+ assert . equal ( str , expectedStr ) ;
161+ } )
162+ . catch ( err => {
163+ return Promise . reject ( err ) ;
164+ } ) ;
173165 } else if ( body instanceof Uint8Array ) {
174166 const str = decodeUint8Array ( body ) ;
175167 assert . equal ( str , expectedStr ) ;
0 commit comments