-
Notifications
You must be signed in to change notification settings - Fork 409
Google Cloud Storage API [WIP] #47
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks really good. Just a few nits and some minor suggestions.
src/storage/storage.ts
Outdated
*/ | ||
public delete(): Promise<void> { | ||
// There are no resources to clean up. | ||
return Promise.resolve(undefined); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Promise.resolve()
Otherwise this would return Promise
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
src/storage/storage.ts
Outdated
} else { | ||
bucketName = this.appInternal.options.storageBucket; | ||
} | ||
if (typeof bucketName !== 'string' || bucketName === '') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion: you can also use validator.sNonEmptyString
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
test/integration/storage.js
Outdated
|
||
function testDefaultBucket() { | ||
const bucket = admin.storage().bucket(); | ||
return verifyBucket(bucket, 'storage().bucker()') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bucket
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
test/unit/storage/storage.spec.ts
Outdated
import {FirebaseApp} from '../../../src/firebase-app'; | ||
import {Storage} from '../../../src/storage/storage'; | ||
|
||
describe('Messaging', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Storage
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
|
||
describe('bucket(valid)', () => { | ||
it('should return a bucket object', () => { | ||
expect(storage.bucket('foo').name).to.equal('foo'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should you add another valid test when no bucket name is added?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
Thanks for the feedback. I've made all the suggested changes. |
Some code borrowed from #38
Exposes Google Cloud Storage API via the Java Admin SDK:
Storage
type that wraps the GCS storage clientbucket()
method.go/firebase-admin-gcs