I have a function that update a variable, but in the coverage its show me that function as if I had not tried it. How can I test if a function was called ? This is my function
changePage(event) {
this.currentPages = event.currentPage - 1;
}
And this is my test
it('Should call the function',()=>{
const newPage = {
currentPage:1
}
component.changePage(newPage);
expect(component.currentPages).toEqual(0);
expect(component.changePage).toHaveBeenCalled();
})