Skip to content

Instantly share code, notes, and snippets.

@makemek
Created June 26, 2016 05:54
Show Gist options
  • Save makemek/e62d3218f743c395e51134d25c168c69 to your computer and use it in GitHub Desktop.
Save makemek/e62d3218f743c395e51134d25c168c69 to your computer and use it in GitHub Desktop.
use sinon to spy a string in nodeJs
var sinon = require("sinon")
str = new String('foo');
var spy = sinon.spy(str, 'replace');
str.replace(str, 'bar');
spy.firstCall.returnValue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment