Skip to content

Commit b8fa983

Browse files
committed
Use Blob.text() instead of FileReader
1 parent 6d6ce81 commit b8fa983

File tree

1 file changed

+4
-15
lines changed

1 file changed

+4
-15
lines changed

packages/storage/test/unit/requests.test.ts

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -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,11 @@ describe('Firebase Storage > Requests', () => {
167154
}
168155

169156
if (typeof Blob !== 'undefined' && body instanceof Blob) {
170-
return readBlob(body).then(str => {
157+
return body.text().then(str => {
171158
assert.equal(str, expectedStr);
172-
});
159+
}).catch(err => {
160+
return Promise.reject(err);
161+
})
173162
} else if (body instanceof Uint8Array) {
174163
const str = decodeUint8Array(body);
175164
assert.equal(str, expectedStr);

0 commit comments

Comments
 (0)