I want to know how the "spyOn" function works internally. I read that the 'spyOn' function internally replaces the implementation of the function being spied on. Does it keep the old functionality?
As an example, suppose I wanted to spy on an object that sends data to a server.
describe("A spy", function() {
var object;
spyOn(object, 'sendDataToServer');
object.sendDataToServer('Some Message');
});
In this case, does the message still get sent to the server or does the spy mock it?