I'm new to jasmine and spies thing, hope you could point to the right direction.
I have an event listener that i want to cover with unit test:
var nextTurn = function() {
continueButton.addEventListener("click", displayComputerSelection)
};
nextTurn();
The general idea is to spy the 'displayComputerSelection' function .
it ("should call fn displayComputerSelection on continueButton click", function(){
spyOn(displayComputerSelection);
continueButton.click();
expect(displayComputerSelection).toHaveBeenCalled();
Since the basic structure of spies is spyOn(<object>, <methodName>)
i get a response No method name supplied
.
I've tried experimenting with jasmine.createSpy but couldn't make it work.
How would i substitute for the method that is expected?