Last active
August 20, 2016 14:44
-
-
Save davelnewton/a2b786fd485b6767606bcb20942c4616 to your computer and use it in GitHub Desktop.
This file contains 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
const sinon = require('sinon') | |
function Example() {} | |
Example.prototype.someFunc1 = function () { return 42; } | |
Example.prototype.func = function (fn) { return fn(); } | |
const example = new Example() | |
console.log(example.func(example.someFunc1)) | |
// >> 42 | |
sinon.stub(example, 'someFunc1').returns(69); | |
console.log(example.func(example.someFunc1)) | |
// >> 69 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment