[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.

原文地址:https://www.cnblogs.com/Answer1215/p/9958859.html