I have to write unit test case for the below code in a function inside ts file
logout() {
this.cookieService.delete('deleted_cookie_name');
}
I have writtern like this using spy.
cookieService=jasmine.createSpyObj(['delete'])
I would have done something like below;
it('should delete cookie name', inject([CookieService], (cookieService: CookieService) => {
const serviceSpy = spyOn(cookieService, 'delete');
component.logout();
expect(serviceSpy).toHaveBeenCalled();
}
))