I have an Angular service which depends on another service, which has a property, which is an object contains a method I want to spy on.
@Injectable({
providedIn: 'root'
})
export class MyService {
constructor(
private secondService:SecondService,
) {
this.secondService.someObj.someMethod();
}
}
@Injectable({
providedIn: 'root'
})
export class SecondService {
someObj = {
someMethod: () => {
//do stuff
}
}
}
How to spy on someMethod
when testing MyService
?