I had a problem with testing in jest and i've found solution like this:
test('the data is peanut butter', (done) => {
function callback(data) {
expect(data).toBe('peanut butter');
done();
}
fetchData(callback);
})
It's working but... In documentation is written that jest will wait until done callback is called before finishing the test.
Could you explain why it's working like this?
Aucun commentaire:
Enregistrer un commentaire