Open raman-nbg opened 4 years ago
Hi @raman-nbg, any good PR to add support for mocking Firebase messaging in the admin SDK would be gladly accepted! Cheers.
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?
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
!
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.
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.
The change is arleady merged into master, but not release yet. Is there any plan to release a new version soon?
Ping!
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()
).