Testing Asynchronous Code · Jest

PHOTO EMBED

Fri Sep 04 2020 05:57:34 GMT+0000 (Coordinated Universal Time)

Saved by @vrzi #javascript #jest

test('the data is peanut butter', () => {
  expect.assertions(1);
  return fetchData().then(data => {
    expect(data).toBe('peanut butter');
  });
});
content_copyCOPY

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