vendredi 6 mars 2020

Mock function for express functions

I have a server.js file it has an app.get function. I want to test this function using "jest". I am getting difficulty to write a mock function of the app.get function below.

app.get('/api/getUser', (req, res) => {
    res.json({
        'email': req.email,
        'name': req.username
    });
});

Aucun commentaire:

Enregistrer un commentaire