import{suite,test}from'@testdeck/mocha';import{assert}from'chai';functionasyncSUT(cb){setTimeout(()=>cb(null,false),100);}@suiteclassSuite{@testtest(done){asyncSUT((err,res)=>{if(err){// expected error testing anyone?returndone(err);}try{assert.isOk(res);returndone();}catch(ex){// we want the test to fail with the assertion error and not just due// to some timeout because done was not called back in timereturndone(ex);}});}}
import{suite,test}from'@testdeck/mocha';import{assert}from'chai';asyncfunctionasyncSUT():Promise<any>{returnPromise.resolve(false);}@suiteclassSuite{@testasynctest(){letres;try{res=awaitasyncSUT();}catch(ex){// expected exception testing anyone? // ...return;}// we would not want to run these assertions in above try because otherwise we would // have to filter them or use a nested try/catch/rethrowassert.isOk(res);}}