Coding & Programming > JavaScript Forum

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

(1/1)

aarav:
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.

Navigation

[0] Message Index

Go to full version