Closed xanderfehsenfeld closed 3 years ago
When I comment the code like so
import { firestore } from "firebase-admin";
import * as functions from "firebase-functions";
export const testFieldValue = functions.firestore
.document("activities/{activity}")
.onWrite(async (change) => {
const data = change.after.data();
if (data) {
// await change.after.ref.set({
// array: firestore.FieldValue.arrayRemove("test"),
// });
}
});
or mock firestore.FieldValue.arrayRemove
the test doesn't throw an error.
Sorry I'm ramping up on the codebase, but I notice you're calling ref.set
with a FieldValue
that doesn't make sense in a set
command. Does this work if you change set
to update
?
We will leave this bug open for another week and will close if we do not hear a response.
Closing for now
Version info
firebase --version
returns9.10.0
./package.json
./functions/package.json
Test case
./functions/src/activities/fieldValue.test.ts
./functions/src/activities/fieldValue.ts
Steps to reproduce
Run the test, which calls a firebase firestore trigger function which uses
firestore.FieldValue.arrayUnion
./package.json
npm run test:watch
Expected behavior
The tests pass and the value 'test' is removed from the array in the document.
Actual behavior