[Unit Testing] Test async function with Jasmine

Most of time, when we want to test function call inside a promise, we can do:

it('Should be async', function(done) {
  someAsyncFunction().then(function(result) {
    expect(result).toBe(true);
    done();
  });
});

It is important to call 'done()', otherwise, the code won't call the promise is finished.

posted @ 2018-11-14 16:52  Zhentiw  阅读(251)  评论(0编辑  收藏  举报