I am trying to peek into $ timeout to verify that it was not called. In particular, my production code (see below) calls $ timeout as a function, not an object:
$timeout(function() { ... })
but not
$timeout.cancel() // for instance
Jasmine, however, requires the object to spy, for example:
spyOn(someObject, '$timeout')
I don't know what "someObject" would be.
I use Angular mocks if that matters.
Edit: The corresponding production code that I am trying to verify is as follows:
EventHandler.prototype._updateDurationInOneSecondOn = function (call) { var _this = this; var _updateDurationPromise = this._$timeout(function () { call.duration = new Date().getTime() - call.startTime; _this._updateDurationInOneSecondOn(call); }, 1000);
In a specific test case, I am trying to argue that $ timeout has never been called.
Edit 2: It is clearly stated that I am using $ timeout as a function, not an object.
source share