Testing onWrite cloud function does not correctly return ref.parent
#84
Labels
type: bug
Something isn't working
ref.parent
#84
Version info
firebase-functions-test: 0.2.3
firebase-functions: 3.12.0
firebase-admin: 9.4.1
Test case
Assume the following firebase function that triggers on a sub-field change:
Now to write a unit test for such function:
Steps to reproduce
So, the exact problem occurs on this line:
return change.after.ref.parent?.once('value').then(snapshot => {
Even though
change.after
does correctly reference only the field that changed, when trying to get it's parentnull
is returned instead of the value in thebeforeSnap
Expected behavior
The correct parent ref is detected or at least there is a way to set it so the real firebase behavior can be replicated
Actual behavior
The ref's parent is set to null, which diverges from real firebase behavior
The text was updated successfully, but these errors were encountered: