I am participating in a unit test using modular node modulation with synon.
Using only bullying and a simple class, I can successfully implement the layout. However, I would like to add a sine stub instead of a simple class, but I have a lot of problems with this.
The class I'm trying to make fun of:
function LdapAuth(options) {}
And here is the code that I use in my beforeEach () function:
beforeEach(function() { ldapAuthMock = sinon.stub(LdapAuth.prototype, "authenticate", function(username, password, callback) {}); mockery.registerMock('ldapauth-fork', ldapAuthMock); mockery.enable(); }); afterEach(function () { ldapAuthMock.restore(); mockery.disable(); });
I tried to make the mdock / stub class LdapAuth in various ways without success, and the code above is just the latest version that doesn't work.
So, I just want to know how to mock it using sine and mockery.
source share