I'm new to Jasmine and have just started using it. I have a library js file with lots of functions which are not associated with any object (i.e. are global). How do I go about spying on these functions?
I tried using window/document as the object, but the spy did not work even though the function was called. I also tried wrapping it in a fake object as follows :
var fakeElement = {};
fakeElement.fakeMethod = myFunctionName;
spyOn(fakeElement, "fakeMethod");
and test with
expect(fakeElement.fakeMethod).toHaveBeenCalled();
This does not work either as the spy did not work