javascript - Do I need to create a mock/stub to test this asynchronous function? -


the function want test asynchronous, function present in class.

do need create mock/stub test function?if yes how create one?

delayedalert(message: string, time: number, cb){              return settimeout(()=>{                 cb(message)},3000)}  //calling function shows asynchronous behavior successfully. 

a popular library stubbing function or api sinon. documentation has lots of around creating stub, , how test it. can used in conjunction mocha run async tests.


Comments

Popular posts from this blog

python - Selenium remoteWebDriver (& SauceLabs) Firefox moseMoveTo action exception -

html - How to custom Bootstrap grid height? -

angular - Copying node modules to wwwroot AspNetCore -