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 support for messaging in Admin SDK #164

Open
raman-nbg opened this issue Dec 15, 2019 · 9 comments
Open

Add support for messaging in Admin SDK #164

raman-nbg opened this issue Dec 15, 2019 · 9 comments

Comments

@raman-nbg
Copy link

Currently Firebase messaging in the admin SDK is not supported. Are there any plans to add support for this?

In my case I need to test/mock multicast message (sendMulticast()).

@dmurvihill
Copy link

Hi @raman-nbg, any good PR to add support for mocking Firebase messaging in the admin SDK would be gladly accepted! Cheers.

@raman-nbg
Copy link
Author

Ok, going to try this.

But one question about the implementation:

Messaging.send(message) (https://firebase.google.com/docs/reference/admin/node/admin.messaging.Messaging.html#send) takes a message as an argument. Should I validate this message according to
https://firebase.google.com/docs/reference/admin/node/TokenMessage.html?

@raman-nbg
Copy link
Author

Or should I implement it like described in erros.md?

@dmurvihill
Copy link

Anyone else interested in mocking admin FCM? @op? If so, I'd love to get your opinion.

Unless it makes a big difference in your workflow, @raman-nbg, I'd suggest preserving the pattern from errors.md and not bother with validating the message.

Note that the message will be a Message instance and not necessarily a TokenMessage!

@dmurvihill
Copy link

One more thing: we are migrating away from this repo in the near future; for now, if you could open your PR against https://github.com/dmurvihill/firebase-mock/, I will be publishing from there.

@raman-nbg
Copy link
Author

Created PR: dmurvihill#43

@raman-nbg
Copy link
Author

In the implementation you can see, that this is one is very simple. Messaging is stateless (send message, get result and forget about it) but the other components like firestore are stateful.

Messaging could also be mocked easily using sinon. But I think we should still add this feature. It's more convenient to have the same test behaviour for all firebase components.

@raman-nbg
Copy link
Author

The change is arleady merged into master, but not release yet. Is there any plan to release a new version soon?

@mull
Copy link

mull commented Nov 30, 2020

Ping!

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

No branches or pull requests

3 participants