You don't need to change this, since they work, but check out the Jasmine spies at some point.  They can do this sort of call tracking stuff more concisely.