-, inorder . , , push push .
[].push(1), , :
spy = function() {
callTracker.track({
object: this,
args: Array.prototype.slice.apply(arguments)
});
, , , .
this.track = function(context) {
calls.push(context);
};
, , , push (, , ( Array), push , ): example:
it('does not use native push', function(){
var arr = [];
spyOn(arr, 'push' ).and.callThrough();
arr.push(1);
expect(arr.push).toHaveBeenCalledWith(1);
});
, ( , ), . , , ( , :)), , , .