0

I have the function with location.reload(). How to write the angular unit test cases for test that reload functionality.

searchregion(){
location.reload();
}

I tried to written the test cases like below. But it shows error "Error: : could not find an object to spy upon reload()":

it('should test the reload functions', () =>{
spyOn(location, 'reload');
component.searchregion();
expect(location.reload).toHaveBeenCalled();
});

Can anyone please help me on this?

VelPaari
  • 11
  • 2

0 Answers0