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
Post a Comment