You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Basically, we have some integration tests that run the triggers against the emulator, but I wanted to have those running against the mocked db instead. Trying to edit a mocked db document doesn't seem to trigger those, the updates are happening correctly but the internal code in the trigger never executes.
Relevant information
I was trying to call the function we have on the trigger, some onUpdate for example, like onUserUpdate is one we want to test, but to directly call those we need to provide the snap and context objects, the snap is defined as a Change which unfortunately I was not able to mock, but the context seems fine as long as you have an object with an EventType it accepts, but complains about trying to parse the Snap as a JSON:|
Qs:
Is it possible to mock the triggers so we can verify if our trigger helpers are being properly called?
Is possible to directly call those triggers somehow?
Once again thank you very much for the hard work done here.
The text was updated successfully, but these errors were encountered:
Update 2: It does not, as the firebase-functions-test has to wrap the onUpdateTrigger function, it overwrites the mocked db instance. Need some other way to wrap the onUpdateTrigger methods.
Summary
Basically, we have some integration tests that run the triggers against the emulator, but I wanted to have those running against the mocked db instead. Trying to edit a mocked db document doesn't seem to trigger those, the updates are happening correctly but the internal code in the trigger never executes.
Relevant information
I was trying to call the function we have on the trigger, some
onUpdate
for example, likeonUserUpdate
is one we want to test, but to directly call those we need to provide thesnap
andcontext
objects, thesnap
is defined as a Change which unfortunately I was not able to mock, but the context seems fine as long as you have an object with an EventType it accepts, but complains about trying to parse the Snap as a JSON:|Qs:
Once again thank you very much for the hard work done here.
The text was updated successfully, but these errors were encountered: