填寫這份《一分鐘調查》,幫我們(開發組)做得更好!去填寫Home

waitForAsync

把一個測試函式包裝進一個非同步測試 Zone。當該 Zone 中的所有非同步呼叫都已完成時,該測試將會自動完成。 可用於包裝 inject呼叫。

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.

檢視"說明"...

waitForAsync(fn: Function): (done: any) => any
      
      waitForAsync(fn: Function): (done: any) => any
    
引數
fn Function
返回值

(done: any) => any

說明

例子:

Example:

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