firebase-functions-test icon indicating copy to clipboard operation
firebase-functions-test copied to clipboard

Firestore context params bind

Open Tomer781 opened this issue 5 years ago • 0 comments
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(() => {});

Tomer781 avatar Sep 20 '20 22:09 Tomer781