Skip to content

Commit

Permalink
refactor!: Misc cleanup (#1917)
Browse files Browse the repository at this point in the history
* test: disable resumable upload in acl test before (#1903)

* build: Streamline `mocha` config (#1905)

* build: Streamline `mocha` config

* fix: Require `--require ts-node/register` first

* refactor: Misc cleanup

Co-authored-by: Denis DelGrosso <[email protected]>
  • Loading branch information
d-goog and ddelgrosso1 authored May 6, 2022
1 parent e8babe2 commit d726b65
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 19 deletions.
11 changes: 7 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,16 @@
"google storage",
"storage"
],
"mocha": {
"require": "ts-node/register",
"extension": "ts"
},
"scripts": {
"predocs": "npm run compile",
"docs": "jsdoc -c .jsdoc.js",
"mocha": "mocha --require ts-node/register --extension ts",
"system-test": "npm run mocha -- system-test --timeout 600000 --exit",
"conformance-test": "npm run mocha -- --parallel --require conformance-test/globalHooks.ts conformance-test/",
"test": "c8 npm run mocha -- test",
"system-test": "mocha system-test --timeout 600000 --exit",
"conformance-test": "mocha --parallel --require ts-node/register --require conformance-test/globalHooks.ts conformance-test/",
"test": "c8 mocha test",
"lint": "gts check",
"samples-test": "npm link && cd samples/ && npm link ../ && npm test && cd ../",
"all-test": "npm test && npm run system-test && npm run samples-test",
Expand Down
7 changes: 2 additions & 5 deletions src/channel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,8 @@ class Channel extends ServiceObject {

super(config);

// TODO: remove type cast to any once ServiceObject's type declaration has
// been fixed. https://github.com/googleapis/nodejs-common/issues/176
const metadata = this.metadata;
metadata.id = id;
metadata.resourceId = resourceId;
this.metadata.id = id;
this.metadata.resourceId = resourceId;
}

stop(): Promise<Metadata>;
Expand Down
18 changes: 9 additions & 9 deletions src/file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -398,13 +398,13 @@ export enum FileExceptionMessages {
STARTS_WITH_TWO_ELEMENTS = 'StartsWith condition must be an array of 2 elements.',
CONTENT_LENGTH_RANGE_MIN_MAX = 'ContentLengthRange must have numeric min & max fields.',
DOWNLOAD_MISMATCH = 'The downloaded data did not match the data from the server. To be sure the content is the same, you should download the file again.',
UPLOAD_MISMATCH_DELETE_FAIL = `The uploaded data did not match the data from the server.
As a precaution, we attempted to delete the file, but it was not successful.
To be sure the content is the same, you should try removing the file manually,
then uploading the file again.
UPLOAD_MISMATCH_DELETE_FAIL = `The uploaded data did not match the data from the server.
As a precaution, we attempted to delete the file, but it was not successful.
To be sure the content is the same, you should try removing the file manually,
then uploading the file again.
\n\nThe delete attempt failed with this message:\n\n `,
UPLOAD_MISMATCH = `The uploaded data did not match the data from the server.
As a precaution, the file has been deleted.
UPLOAD_MISMATCH = `The uploaded data did not match the data from the server.
As a precaution, the file has been deleted.
To be sure the content is the same, you should try uploading the file again.`,
}

Expand Down Expand Up @@ -1555,8 +1555,8 @@ class File extends ServiceObject<File> {
* `options.predefinedAcl = 'publicRead'`)
* @property {string} [userProject] The ID of the project which will be
* billed for the request.
* @property {string} [chunkSize] Create a separate request per chunk. Should
* be a multiple of 256 KiB (2^18).
* @property {string} [chunkSize] Create a separate request per chunk. This
* value is in bytes and should be a multiple of 256 KiB (2^18).
* {@link https://cloud.google.com/storage/docs/performing-resumable-uploads#chunked-upload| We recommend using at least 8 MiB for the chunk size.}
*/
/**
Expand Down Expand Up @@ -2027,7 +2027,7 @@ class File extends ServiceObject<File> {

if (destination) {
fileStream.on('error', callback).once('data', data => {
// We know that the file exists the server
// We know that the file exists the server - now we can truncate/write to a file
const writable = fs.createWriteStream(destination);
writable.write(data);
fileStream.pipe(writable).on('error', callback).on('finish', callback);
Expand Down
2 changes: 1 addition & 1 deletion system-test/storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1006,7 +1006,7 @@ describe('storage', () => {
await setUniformBucketLevelAccess(bucket, true);

file = bucket.file(`file-${uuid.v4()}`);
await file.save('data');
await file.save('data', {resumable: false});
});

it('should fail to get file ACL', () => {
Expand Down

0 comments on commit d726b65

Please sign in to comment.