mercredi 1 août 2018

Mocking chained methods

(I use Jest for testing) For example, I have this function:

const find = () => {
    return {
        where: () => {
            in: () => {}
        }
    };
};

and I call that in different place:

find('me').where('id').in(['123']);

How to mock and test calls in find(), where() and in()?

Aucun commentaire:

Enregistrer un commentaire