Skip to content
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

Add node8 firebase snippets #719

Merged
merged 5 commits into from
Aug 27, 2018
Merged

Add node8 firebase snippets #719

merged 5 commits into from
Aug 27, 2018

Conversation

ace-n
Copy link
Contributor

@ace-n ace-n commented Aug 23, 2018

@ace-n ace-n requested a review from fhinkel August 23, 2018 04:12
@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Aug 23, 2018
@codecov
Copy link

codecov bot commented Aug 23, 2018

Codecov Report

Merging #719 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #719   +/-   ##
=======================================
  Coverage   55.17%   55.17%           
=======================================
  Files           1        1           
  Lines          58       58           
=======================================
  Hits           32       32           
  Misses         26       26

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4e4247a...328689f. Read the comment docs.


// [START functions_firebase_auth_node8]
/**
* Triggered by a change to a Firebase Auth user object.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment as before: it's only creation or deletion, not a change.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

const triggerResource = context.resource;

console.log(`Function triggered by change to: ${triggerResource}`);
console.log(`Admin?: ${!!data.admin}`);
Copy link
Contributor Author

@ace-n ace-n Aug 23, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@stew-r is this correct, or will data.admin always be undefined?

@ace-n ace-n added the do not merge Indicates a pull request not ready for merge, due to either quality or timing. label Aug 24, 2018
@ace-n
Copy link
Contributor Author

ace-n commented Aug 24, 2018

TODO: add tests

@ace-n ace-n removed the do not merge Indicates a pull request not ready for merge, due to either quality or timing. label Aug 27, 2018
@ace-n
Copy link
Contributor Author

ace-n commented Aug 27, 2018

Tests have been added - @fhinkel please review?

console.log(`Function triggered by change to: ${triggerResource}`);

console.log(`\nOld value:`);
console.log(JSON.stringify(data.oldValue, null, 2));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the double space necessary? I personally would prefer shorter code without the extra params.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not strictly necessary, but makes it easier to read. (Without it, everything is compressed into one line.)

@@ -19,7 +19,9 @@
"url": "https://github.com/GoogleCloudPlatform/nodejs-docs-samples/issues"
},
"dependencies": {
"ava": "^0.25.0"
"@google-cloud/nodejs-repo-tools": "^2.3.3",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

repo-tools and ava should be dev dependencies.

Copy link
Contributor Author

@ace-n ace-n Aug 27, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

'use strict';

const uuid = require('uuid');
const test = require(`ava`);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inconsistent quotes.

ace-n pushed a commit that referenced this pull request Nov 14, 2022
ace-n pushed a commit that referenced this pull request Nov 21, 2022
ace-n pushed a commit that referenced this pull request Nov 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants