Hi Peter,
It's _almost_ correct :) The clue is that "Class" is a function, not an object, so to
create stubbed methods for its instances, you need to stub on the prototype, OR
return stubbed objects from the constructor.
Approach #1: Stub prototype
# ...
stub = sinon.stub(mod.submod.Class.prototype, "method");
# ...exercise SUT
# assert that stub.method was called
stub.restore();
# ...
Approach #2: Stub returned objects from constructor (this way you must mimic
the entire API being used):
# ...
stub = sinon.stub(mod.submod, "Class").returns({ method: sinon.stub() }, ...);
# ...exercise SUT
# assert that stub.method was called
stub.restore();
# ...
--
MVH
Christian