I have a task to test gRPC client call functions with Jest. Here is what a typical node.js function looks like:
client.authenticate(request, meta, (error, response) => {
if (!error) {
console.log('REPLY FROM SERVER: ', response)
} else {
console.error(error)
}
})
Procedure calls are callback functions, as we see I can not export response object to outside variable. The above function is the one I need to test. I need to check if the function has been called with no error. How do I do it with jest? Been struggling for a while now.
Aucun commentaire:
Enregistrer un commentaire