You need to call the myView()
function so the myLinks()
have been called.
function myLinks(){
//some tasks
}
function myView() {
myLinks();
}
This two function above are declared in window object, then you create a spy object pointing to the window.
describe('#myView', function() {
myView();//Call the method so the myLinks was called too
it('updates link', function() {
var spyEvent = spyOn(window, 'myLinks');
expect(spyEvent).toHaveBeenCalled();
});
});