1

Hi guys im new to jasmine and I am currently running some tests. I am not sure if what im doing the correct thing but I the thing is I want to fetch a data first from an api. And then I will loop through the data and construct my it statements.

describe('some string', async () => {
  const data = await fetchData();
  data.items.forEach((item) => {
     it('some string', () => {
        //do some test
     })
  });
});

But it doesnt seem to wait for the fetchData and immediately start the loop. Can someone please help me?

Karias Bolster
  • 955
  • 3
  • 17
  • 31
  • That's weird, it should wait for `fetchData`. Are you sure `fetchData()` returns a promise? https://jasmine.github.io/tutorials/async there is the documentation for Async tests for Jasmine if you haven't seen it already. – AliF50 Nov 02 '20 at 18:43

0 Answers0