firebase-functions-test
firebase-functions-test copied to clipboard
Firestore context params bind
trafficstars
While using the library to emulate a firestore document event, I noticed that I have to send the params separately. This is a suggestion to bind the params from the DocumentSnapshot refPath property.
enable this usage:
const snap = test.firestore.makeDocumentSnapshot({}, 'wildcard/111/anotherwildcard/111');
const wrapped = test.wrap(myFunctions.matchApartmentToUsers);
return wrapped(snap).then(() => {});
instead of:
const snap = test.firestore.makeDocumentSnapshot({}, 'wildcard/111/anotherwildcard/111');
const wrapped = test.wrap(myFunctions.matchApartmentToUsers);
return wrapped(snap, {params:{wildcard:"111",anotherwildcard:"111"}}).then(() => {});