How to use sinon for stubing in mocha node.js?

Started by aarav, 11-11-2016, 03:47:36

Previous topic - Next topic

aaravTopic starter

Hi, I am working on javascript programming & it allows me to learn HTML which enhance my knowledge of AJAX, JSON and DOM Objects in Javascript which helps me in my learnings. I have faced an issue that how can I use sinon for stubing in mocha node.js which is a feature-rich JavaScript test framework running on Node.js making asynchronous testing simple and fun. I have read related info in almost all javascript developer forums and I also found this platform very useful. I hope any tech developer will resolve my issue.
  •  


Lishmalinyjames

var stub = sinon. stub(object, "foo"); //do your assertions stub. restore(); //back to normal now. This will allow you to create a default function that replaces object.