Open itsravenous opened 3 years ago
@itsravenous Did you ever manage to figure this out? Running into the same problem.
@itsravenous Did you ever manage to figure this out? Running into the same problem.
Nope, I ended up writing integration tests instead, using firebase-admin
to write data to firestore and then reading it back within a wait function to make assertions on it to verify the cloud function did its job. Not ideal, but I had to get some sort of coverage and move on!
Version info
firebase-functions-test: 0.2.3
firebase-functions: 3.13.0
firebase-admin: 9.4.1
Test case
myfunc.js: (based on this example about writing to the same document that triggered the function)
myfunc.test.js:
Steps to reproduce
FIRESTORE_EMULATOR_HOST=localhost:8080
Expected behavior
afterSnap
should have a new field,name_upper
with valueFOO
Actual behavior
It only has the original field ,
name
:I am, however, able to write to a new document in the emulator Firestore instance from within the cloud function, e.g: