I am using a private variable in Angular-6 service.ts.
private tagSubject = new Subject<any>();
It is been used like
sendNewTagMessage(message: string) {
this.tagSubject.next({ text: message });
}
clearNewTagMessage() {
this.tagSubject.next();
}
I want to write a unit test for tagSubject.
I cant do service.tagSubject.subscribe
in the spec.ts as it is giving error like Property 'tagSubject' is private and only accessible within class
. What can I do now. Please help.
component['tagSubject']
or
(component as any).tagSubject