GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — Functions by jmdobry · Pull Request #245 · GoogleCloudPlatform/nodejs-docs-samples Conversation
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
Member
Author
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
|
There was an error while loading. Please reload this page.
|
@jmdobry Missing module is causing CircleCI tests to fail - mind fixing that?
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Will do |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
6478988 to
02e99ac
Compare
|
CLAs look good, thanks! |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Current coverage is 92.06% (diff: 98.49%)@@ master #245 diff @@ ========================================== Files 66 66 Lines 2639 2634 -5 Methods 0 0 Messages 0 0 Branches 0 0 ========================================== - Hits 2434 2425 -9 - Misses 205 209 +4 Partials 0 0
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
(These are comments from looking at the code - I'll run through the tutorials now and post my feedback here once I'm done.)
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| } | ||
| describe(`functions:datastore`, () => { | ||
| it(`set: Set fails without a value`, () => { | ||
| const expectedMsg = `Value not provided. Make sure you have a "value" property in your request`; |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Meta-question/nit: some tests store expected results in their own variables, while others put the constants directly in the assert call. Is this something we should standardize, or am I being pedantic?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I feel like the general pattern I follow is to pull the expected value into a variable when the line is getting long.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| * @param {function} The callback function. | ||
| */ | ||
| exports.helloBackgroundError = function helloBackgroundError (context, data) { | ||
| exports.helloBackgroundError = function helloBackgroundError (event, callback) { |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Can this be made into an arrow function?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
The comment is supposed to be there, indicating that the user would put their own code there.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| // All is good, respond with a message | ||
| return context.success('Hello World!'); | ||
|
|
||
| // Do something |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Delete this comment, unless there's something missing here?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
The comment is supposed to be there, indicating that the user would put their own code there.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| throw new Error('Bucket not provided. Make sure you have a ' + | ||
| '"bucket" property in your request'); | ||
| // [START functions_word_count_stream] | ||
| function getFileStream (file) { |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Should we clarify that file is an object or use a different name? (e.g. fileObj)
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I'll delete the region tag, as it's not shown in the docs.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| return fs.createReadStream(filepath, { encoding: 'utf8' }); | ||
| } | ||
| const file = { | ||
| createReadStream: () => fs.createReadStream(path.join(__dirname, `../${filename}`), { encoding: `utf8` }) |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Should we split this into more than 1 line? e.g:
createReadStream: () => fs.createReadStream( path.join(...), { encoding: 'utf8' } )
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Sure.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| assert.deepEqual(sample.mocks.res.status.callCount, 1); | ||
| assert.deepEqual(sample.mocks.res.status.firstCall.args, [500]); | ||
| assert.deepEqual(sample.mocks.res.send.callCount, 1); | ||
| assert.deepEqual(sample.mocks.res.send.firstCall.args[0].message, expectedMsg); |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Nit: why deepEqual?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Fixed
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| assert.deepEqual(sample.mocks.res.status.callCount, 1); | ||
| assert.deepEqual(sample.mocks.res.status.firstCall.args, [500]); | ||
| assert.deepEqual(sample.mocks.res.send.callCount, 1); | ||
| assert.deepEqual(sample.mocks.res.send.firstCall.args[0].message, expectedMsg); |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Nit: why deepEqual?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Fixed
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| if (!requestBody.to) { | ||
| var error = new Error('To email address not provided. Make sure you have a ' + | ||
| '"to" property in your request'); | ||
| const error = new Error('To email address not provided. Make sure you have a "to" property in your request'); |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
A few nits:
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
code property to it.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| throw new Error('Filename not provided. Make sure you have a ' + | ||
| '"name" property in your request'); | ||
| } | ||
| exports.sendgridLoad = function sendgridLoad (event) { |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
These docstrings and parameters don't match up. 😕
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Fixed
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| // Extract the first entity from the result list, if any | ||
| if (response && response.itemListElement && | ||
| response.itemListElement.length) { | ||
| if (response && response.itemListElement && response.itemListElement.length) { |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Maybe clarify the .length part? (e.g. .length > 0?)
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Done
Sorry, something went wrong.
There was an error while loading. Please reload this page.
1930ef8 to
a63abfb
Compare
| * @returns {Promise} | ||
| */ | ||
| exports.helloPromise = function helloPromise (data) { | ||
| exports.helloPromise = function helloPromise (event) { |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Do we need the function names here?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Makes for better stack traces.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| gcloud alpha functions deploy del --stage-bucket YOUR_BUCKET_NAME --trigger-http | ||
|
|
||
| * Replace `[YOUR_BUCKET_NAME]` with the name of your Cloud Storage Bucket. | ||
| * Replace `YOUR_BUCKET_NAME` with the name of your Cloud Storage Bucket. |
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Does this need to be repeated every time, or can we just have a blanket notice?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Done.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Fixed some stuff related to the OCR sample. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
* updated CHANGELOG.md * updated package.json * updated samples/package.json
* updated CHANGELOG.md * updated package.json * updated samples/package.json
* chore(main): release 3.0.2 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
* chore(main): release 3.0.2 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
* chore(main): release 3.0.2 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
🤖 I have created a release \*beep\* \*boop\* --- ### [3.0.1](https://www.github.com/googleapis/nodejs-document-ai/compare/v3.0.0...v3.0.1) (2021-07-21) ### Bug Fixes * **deps:** google-gax v2.17.1 ([#243](https://www.github.com/googleapis/nodejs-document-ai/issues/243)) ([a9e4efd](https://www.github.com/googleapis/nodejs-document-ai/commit/a9e4efd2478def845376a951c40b76e3384a8b29)) * Updating WORKSPACE files to use the newest version of the Typescript generator. ([#245](https://www.github.com/googleapis/nodejs-document-ai/issues/245)) ([06bf319](https://www.github.com/googleapis/nodejs-document-ai/commit/06bf3190cad3c9ce98e13aff718bb11db85dd4e5)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
🤖 I have created a release \*beep\* \*boop\* --- ### [3.0.1](https://www.github.com/googleapis/nodejs-document-ai/compare/v3.0.0...v3.0.1) (2021-07-21) ### Bug Fixes * **deps:** google-gax v2.17.1 ([#243](https://www.github.com/googleapis/nodejs-document-ai/issues/243)) ([a9e4efd](https://www.github.com/googleapis/nodejs-document-ai/commit/a9e4efd2478def845376a951c40b76e3384a8b29)) * Updating WORKSPACE files to use the newest version of the Typescript generator. ([#245](https://www.github.com/googleapis/nodejs-document-ai/issues/245)) ([06bf319](https://www.github.com/googleapis/nodejs-document-ai/commit/06bf3190cad3c9ce98e13aff718bb11db85dd4e5)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
🤖 I have created a release \*beep\* \*boop\* --- ### [3.0.1](https://www.github.com/googleapis/nodejs-document-ai/compare/v3.0.0...v3.0.1) (2021-07-21) ### Bug Fixes * **deps:** google-gax v2.17.1 ([#243](https://www.github.com/googleapis/nodejs-document-ai/issues/243)) ([a9e4efd](https://www.github.com/googleapis/nodejs-document-ai/commit/a9e4efd2478def845376a951c40b76e3384a8b29)) * Updating WORKSPACE files to use the newest version of the Typescript generator. ([#245](https://www.github.com/googleapis/nodejs-document-ai/issues/245)) ([06bf319](https://www.github.com/googleapis/nodejs-document-ai/commit/06bf3190cad3c9ce98e13aff718bb11db85dd4e5)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
🤖 I have created a release \*beep\* \*boop\* --- ### [3.0.1](https://www.github.com/googleapis/nodejs-document-ai/compare/v3.0.0...v3.0.1) (2021-07-21) ### Bug Fixes * **deps:** google-gax v2.17.1 ([#243](https://www.github.com/googleapis/nodejs-document-ai/issues/243)) ([a9e4efd](https://www.github.com/googleapis/nodejs-document-ai/commit/a9e4efd2478def845376a951c40b76e3384a8b29)) * Updating WORKSPACE files to use the newest version of the Typescript generator. ([#245](https://www.github.com/googleapis/nodejs-document-ai/issues/245)) ([06bf319](https://www.github.com/googleapis/nodejs-document-ai/commit/06bf3190cad3c9ce98e13aff718bb11db85dd4e5)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
🤖 I have created a release \*beep\* \*boop\* --- ## [2.3.0](https://www.github.com/googleapis/nodejs-datacatalog/compare/v2.2.0...v2.3.0) (2021-04-27) ### Features * new RenameTagTemplateFieldEnumValue API ([#244](https://www.github.com/googleapis/nodejs-datacatalog/issues/244)) ([1efaf9b](https://www.github.com/googleapis/nodejs-datacatalog/commit/1efaf9be12b84135643761cf01372726ec7dd249)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
🤖 I have created a release \*beep\* \*boop\* --- ## [2.3.0](https://www.github.com/googleapis/nodejs-datacatalog/compare/v2.2.0...v2.3.0) (2021-04-27) ### Features * new RenameTagTemplateFieldEnumValue API ([#244](https://www.github.com/googleapis/nodejs-datacatalog/issues/244)) ([1efaf9b](https://www.github.com/googleapis/nodejs-datacatalog/commit/1efaf9be12b84135643761cf01372726ec7dd249)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
* updated CHANGELOG.md [ci skip] * updated package.json [ci skip] * updated samples/package.json [ci skip]
* updated CHANGELOG.md [ci skip] * updated package.json [ci skip] * updated samples/package.json [ci skip]
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.