Why i have to call await asyncMock() twice?
test('async test', async () => {
const asyncMock = jest
.fn()
.mockResolvedValueOnce('first call')
.mockRejectedValueOnce(new Error('Async error'));
await asyncMock(); // first call
await asyncMock(); // throws "Async error"
});
This code snippet is taken from jest documentation
Aucun commentaire:
Enregistrer un commentaire