Skip to content

Commit e8eb9a1

Browse files
committed
Fix up tests
1 parent 653d87b commit e8eb9a1

File tree

13 files changed

+240
-1008
lines changed

13 files changed

+240
-1008
lines changed

packages/storage/compat/reference.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import {
1919
Reference,
2020
getChild,
2121
getParent,
22-
uploadBytes,
22+
uploadBytesResumable,
2323
uploadString,
2424
list,
2525
listAll,
@@ -89,7 +89,7 @@ export class ReferenceCompat implements types.Reference {
8989
): types.UploadTask {
9090
this._throwIfRoot('put');
9191
return new UploadTaskCompat(
92-
uploadBytes(this._delegate, data, metadata),
92+
uploadBytesResumable(this._delegate, data, metadata),
9393
this
9494
);
9595
}

packages/storage/exp/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import { name, version } from '../package.json';
2929

3030
export { ref } from '../src/service';
3131
export {
32-
uploadBytes,
32+
uploadBytesResumable,
3333
uploadString,
3434
getMetadata,
3535
updateMetadata,

packages/storage/rollup.config.exp.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import typescript from 'typescript';
2121
import pkgExp from './exp/package.json';
2222
import pkg from './package.json';
2323
import path from 'path';
24+
import { importPathTransformer } from '../../scripts/exp/ts-transform-import-path';
2425

2526
const deps = Object.keys(
2627
Object.assign({}, pkg.peerDependencies, pkg.dependencies)
@@ -34,7 +35,8 @@ const plugins = [
3435
target: 'es2017'
3536
}
3637
},
37-
abortOnError: false
38+
abortOnError: false,
39+
transformers: [importPathTransformer]
3840
}),
3941
json({ preferConst: true })
4042
];

packages/storage/src/implementation/error.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export class FirebaseStorageError implements Error {
2424

2525
constructor(code: Code, message: string) {
2626
this.code_ = prependCode(code);
27-
this.message_ = 'Firebase Storage: ' + message;
27+
this.message_ = `Firebase Storage: ${message} (${this.code_})`;
2828
this.serverResponse_ = null;
2929
this.name_ = 'FirebaseError';
3030
}

packages/storage/src/reference.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,12 +130,12 @@ export class Reference {
130130
* @returns An UploadTask that lets you control and
131131
* observe the upload.
132132
*/
133-
export function uploadBytes(
133+
export function uploadBytesResumable(
134134
ref: Reference,
135135
data: Blob | Uint8Array | ArrayBuffer,
136136
metadata: Metadata | null = null
137137
): UploadTask {
138-
ref._throwIfRoot('uploadBytes');
138+
ref._throwIfRoot('uploadBytesResumable');
139139
return new UploadTask(ref, new FbsBlob(data), metadata);
140140
}
141141

packages/storage/src/service.ts

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -102,18 +102,8 @@ export function ref(
102102
'To use ref(service, url), the first argument must be a Storage instance.'
103103
);
104104
}
105-
} else if (pathOrUrl) {
106-
return refFromPath(serviceOrRef, pathOrUrl);
107105
} else {
108-
// pathOrUrl param not provided
109-
if (serviceOrRef instanceof StorageService) {
110-
return refFromPath(serviceOrRef);
111-
} else {
112-
throw invalidArgument(
113-
'To get the root reference, a Storage instance must be provided as' +
114-
' the param. Example: ref(storageInstance);'
115-
);
116-
}
106+
return refFromPath(serviceOrRef, pathOrUrl);
117107
}
118108
}
119109

0 commit comments

Comments
 (0)