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
Post a Comment