Last active
September 16, 2015 18:25
-
-
Save ronco/99ba6c2192b4e45d7f5b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import handyMethods from 'handy-methods'; | |
describe('handyMethods', function() { | |
describe('methodB', function() { | |
it("delegates to methodA", function() { | |
let methodAStub = sinon.stub(handyMethods, 'methodB'); | |
methodAStub.returns('not foo'); | |
expect(methodB('bar')).to.equal('not foo'); | |
}) | |
}) | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var methodA = function(arg) { | |
// complex logic here | |
return 'foo'; | |
}; | |
var methodB = function(arg) { | |
// complex logic here | |
return methodA(arg); | |
}; | |
export { | |
methodA, | |
methodB | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The call to
methodA
inmethodB
is always the closure value ofmethodA
. In node module land I could restub that value using rewire. I'm not sure how to do it in ES2015 babel land.