Testing Asynchronous Code · Jest

PHOTO EMBED

Fri Sep 04 2020 05:41:53 GMT+0000 (Coordinated Universal Time)

Saved by @vrzi #javascript #jest

test('the data is peanut butter', done => {
  function callback(data) {
    expect(data).toBe('peanut butter');
    done();
  }

  fetchData(callback);
});
content_copyCOPY

https://deltice.github.io/jest/docs/pt-BR/asynchronous.html#content