Skip to content

Instantly share code, notes, and snippets.

@philipjrose
Created July 20, 2011 10:24
Show Gist options
  • Save philipjrose/1094726 to your computer and use it in GitHub Desktop.
Save philipjrose/1094726 to your computer and use it in GitHub Desktop.
Possible issue with Sinon.JS with child properties of stubbed functions
var MyClass = function(myVar)
{
// example constructor
this.myVar = myVar;
}
MyClass.MyNamespacedClass = function()
{
// could be any property, not necessarily a function
}
console.log(typeof MyClass.MyNamespacedClass); // "function"
var myClassStub = sinon.stub(window, "MyClass");
console.log(typeof MyClass.MyNamespacedClass); // "undefined"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment