async

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

把一个测试函数包装进一个异步测试区域(Zone)。当该区域中的所有异步调用都已完成时,该测试将会自动完成。 可用于包装 inject调用。

See more...

async(fn: Function): (done: any) => any

参数

fn

Type: Function.

返回值

(done: any) => any

说明

Example:

例子:

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