How do you test whether a method is called witin the constructor of an object with Jasmine.js?
Turns out, you need to spyOn() the "raw" reference of the "method", which
really just a function on the prototype of your "class" object. An example
will make it clear:
// is 'load()' getting called during construction?
describe("MyObject", function() {
it("should call load() during construction", function() {
spyOn(MyObject.prototype, 'load');
new MyObject();
expect(MyObject.prototype.load).toHaveBeenCalled();
});
}