Skip to content

Implemented IID Delete API#142

Merged
hiranya911 merged 11 commits intomasterfrom
hkj-delete-iid
Dec 20, 2017
Merged

Implemented IID Delete API#142
hiranya911 merged 11 commits intomasterfrom
hkj-delete-iid

Conversation

@hiranya911
Copy link
Contributor

A new API that enables deleting instance IDs associated with a Firebase project.

let result: Promise<void> = admin.instanceId().deleteInstanceId(iid);

go/firebase-admin-iid

Copy link
Contributor

@bojeil-google bojeil-google left a comment

Choose a reason for hiding this comment

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

Looks good! Mostly nits.

Copy link
Contributor

Choose a reason for hiding this comment

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

Update comment: Firebase IID backend endpoints.

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

Copy link
Contributor

Choose a reason for hiding this comment

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

Update the indentation to be consistent. We use 2 spaces in this case.

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

Copy link
Contributor

Choose a reason for hiding this comment

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

Fix indentation

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

Copy link
Contributor

Choose a reason for hiding this comment

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

Indentation needs to be fixed here too and the rest of the class.

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

Copy link
Contributor

Choose a reason for hiding this comment

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

Let's stick with no trailing _ for private variables. This is also the recommended style for ts.

Copy link
Contributor Author

@hiranya911 hiranya911 Dec 8, 2017

Choose a reason for hiding this comment

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

That is going to conflict with the get app() getter. Is it better to remove that, and expose app as a public attribute of this class? But I guess that would make app writable, which we don't want.

it('should return a valid namespace when the named app is initialized', () => {
let app: FirebaseApp = firebaseNamespace.initializeApp(mocks.appOptions, 'testApp');
let iid: InstanceId = firebaseNamespace.instanceId(app);
expect(iid).to.not.be.null;
Copy link
Contributor

Choose a reason for hiding this comment

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

Add check:
expect(iid.app).to.be.deep.equal(app);

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

Copy link
Contributor

Choose a reason for hiding this comment

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

fix indentation

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


it('should be rejected given no instance ID', () => {
return (iid as any).deleteInstanceId()
.should.eventually.be.rejected.and.have.property('code', 'instance-id/invalid-instance-id');
Copy link
Contributor

Choose a reason for hiding this comment

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

Indent second line .should... and .then below too.

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

Copy link
Contributor

Choose a reason for hiding this comment

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

Why don't you use should.eventually.be.rejected.and.have... like above

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

Copy link
Contributor

Choose a reason for hiding this comment

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

Update comment getAccountInfoByUid

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

@hiranya911
Copy link
Contributor Author

Made the suggested changes, and left one question. Over to @bojeil-google for another look.

@hiranya911
Copy link
Contributor Author

@bojeil-google I pushed a couple of commits to improve error handling and test coverage. PTAL.

});
});

describe('deleteInstanceId', () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks good. One suggestion: i think it would be a good idea to also confirm the error code too.

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

@hiranya911 hiranya911 merged commit 52bfaca into master Dec 20, 2017
@hiranya911 hiranya911 deleted the hkj-delete-iid branch December 20, 2017 19:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments