Skip to content

Fix Storage Node tests #8443

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Aug 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/storage/test/integration/integration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -215,5 +215,5 @@ describe('FirebaseStorage Exp', () => {
await task;
const bytes = await getBytes(referenceA);
expect(bytes).to.deep.eq(bytesToUpload);
});
}).timeout(10_000);
});
24 changes: 8 additions & 16 deletions packages/storage/test/unit/requests.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,19 +145,6 @@ describe('Firebase Storage > Requests', () => {

const metadataContentType = 'application/json; charset=utf-8';

function readBlob(blob: Blob): Promise<string> {
const reader = new FileReader();
reader.readAsText(blob);
return new Promise((resolve, reject) => {
reader.onload = () => {
resolve(reader.result as string);
};
reader.onerror = () => {
reject(reader.error as Error);
};
});
}

async function assertBodyEquals(
body: Blob | string | Uint8Array | null,
expectedStr: string
Expand All @@ -167,9 +154,14 @@ describe('Firebase Storage > Requests', () => {
}

if (typeof Blob !== 'undefined' && body instanceof Blob) {
return readBlob(body).then(str => {
assert.equal(str, expectedStr);
});
return body
.text()
.then(str => {
assert.equal(str, expectedStr);
})
.catch(err => {
return Promise.reject(err);
});
} else if (body instanceof Uint8Array) {
const str = decodeUint8Array(body);
assert.equal(str, expectedStr);
Expand Down
Loading