@@ -145,19 +145,6 @@ describe('Firebase Storage > Requests', () => {
145
145
146
146
const metadataContentType = 'application/json; charset=utf-8' ;
147
147
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
-
161
148
async function assertBodyEquals (
162
149
body : Blob | string | Uint8Array | null ,
163
150
expectedStr : string
@@ -167,9 +154,14 @@ describe('Firebase Storage > Requests', () => {
167
154
}
168
155
169
156
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
+ } ) ;
173
165
} else if ( body instanceof Uint8Array ) {
174
166
const str = decodeUint8Array ( body ) ;
175
167
assert . equal ( str , expectedStr ) ;
0 commit comments