Skip to content

Conversation

@laurenzlong
Copy link
Contributor

Description

Update dependency to firebase-admin v5.0.0, also added shim to transform auth event payload into the new format UserRecord format from firebase-admin.

Code sample

photoURL: 'bar.baz/foo.jpg',
disabled: false,
metadata: {
creationTime: '2016-12-15T19:37:37.059Z',
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add a small comment to call out the difference between the old and new wire formats here?

@laurenzlong
Copy link
Contributor Author

Made some changes according to our deprecation discussion, @rjhuijsman can you take another look? I also removed the test for "should tolerate missing fields in the payload" since the test events for the other tests is already missing fields.

Copy link
Contributor

@rjhuijsman rjhuijsman left a comment

Choose a reason for hiding this comment

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

Thanks! Just two small comments, otherwise LGTM!

// handle it gracefully.
it('should tolerate missing fields in the payload', () => {
const cloudFunction = auth.user().onCreate((ev: Event<firebase.auth.UserRecord>) => ev.data);
it('should still retain createdAt and lastSignedIn', () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

A comment on what "createdAt" and "lastSignedIn" are and why they should be retained would be useful.


return expect(cloudFunction(event)).to.eventually.deep.equal(event.data);
return Promise.all([
cloudFunctionCreate(newEvent).then(data => {
Copy link
Contributor

Choose a reason for hiding this comment

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

We should also expect that the fields with the old name are still present in this case with the new wire format.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants