javascript - Mock parameters for a database triggered firebase function -




how mock parameters database triggered firebase function in unit test?

i tried specifying params in fakeevent below. after passing event in test comes undefined.

// cloud function userid parameter module.exports.userupdated = functions.database.ref('users/{userid}').onwrite(event => {     // userid undefined when calling function in unit      // tests fake event below     console.log(event.params.userid); // undefined });  // testing cloud function let fakeevent = {     data: new functions.database.deltasnapshot(null, null, null, 'input'),     params: {userid: 'abc123'} // not working, userid undefined (see above) }; myfunctions.userupdated(fakeevent).then(() => {     assert(true); }); 





wiki

Comments

Popular posts from this blog

Asterisk AGI Python Script to Dialplan does not work -

python - Read npy file directly from S3 StreamingBody -

kotlin - Out-projected type in generic interface prohibits the use of metod with generic parameter -