Spec has no expectations - Jasmine testing the callback function

前端 未结 3 1179
清酒与你
清酒与你 2020-12-20 10:59

I have a method which is being called using a d3 timer. Whenever the method is called, the method emits an object with a couple of values. One of the values in

3条回答
  •  我在风中等你
    2020-12-20 11:38

    Try using async function from @angular/core/testing. It

    Wraps a test function in an asynchronous test zone. The test will automatically complete when all asynchronous calls within this zone are done. Can be used to wrap an {@link inject} call.

    Please find code example below:

    it('...', async(inject([AClass], (object) => {
      object.doSomething.then(() => {
       expect(...);
      })
    });
    

提交回复
热议问题