Skip to content

Instantly share code, notes, and snippets.

@efleming969
Created August 7, 2016 15:19
Show Gist options
  • Save efleming969/1b23a4ebeac84780ad25bf80298dcd62 to your computer and use it in GitHub Desktop.
Save efleming969/1b23a4ebeac84780ad25bf80298dcd62 to your computer and use it in GitHub Desktop.
JavaScript stubbing example
it( 'stubbing example', function() {
var b = new main.DataService();
var a = new main.Foo( b );
sinon.stub( b, "lookupMultiplier" ).returns( 2 );
var result = a.calculateValueUsingLookup( 5 );
assert.equal( result, 10 );
} );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment