File tree Expand file tree Collapse file tree 1 file changed +4
-15
lines changed
packages/storage/test/unit Expand file tree Collapse file tree 1 file changed +4
-15
lines changed Original file line number Diff line number Diff line change @@ -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,11 @@ describe('Firebase Storage > Requests', () => {
167
154
}
168
155
169
156
if ( typeof Blob !== 'undefined' && body instanceof Blob ) {
170
- return readBlob ( body ) . then ( str => {
157
+ return body . text ( ) . then ( str => {
171
158
assert . equal ( str , expectedStr ) ;
172
- } ) ;
159
+ } ) . catch ( err => {
160
+ return Promise . reject ( err ) ;
161
+ } )
173
162
} else if ( body instanceof Uint8Array ) {
174
163
const str = decodeUint8Array ( body ) ;
175
164
assert . equal ( str , expectedStr ) ;
You can’t perform that action at this time.
0 commit comments