Skip to content

Commit 12ba46f

Browse files
authored
Fix Storage Node tests (#8443)
1 parent 1ff9661 commit 12ba46f

File tree

2 files changed

+9
-17
lines changed

2 files changed

+9
-17
lines changed

packages/storage/test/integration/integration.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,5 +215,5 @@ describe('FirebaseStorage Exp', () => {
215215
await task;
216216
const bytes = await getBytes(referenceA);
217217
expect(bytes).to.deep.eq(bytesToUpload);
218-
});
218+
}).timeout(10_000);
219219
});

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

Lines changed: 8 additions & 16 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,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

Comments
 (0)