I got private class members in my component, for example
private querySubscription: Subscription;
.
In my ngOnDestroy()
I unsubscribe from my subscription:
ngOnDestroy(): void {
this.querySubscription.unsubscribe();
this.userSettingsSubscription.unsubscribe();
}
How do I test that I have really unsubscribed correctly in my unit test in jasmine? I can programmatically call the ngOnDestory()
because it is public, but I can not test my private class members.
querySubscription
anduserSettingsSubscription
and then replace(with spy?)unsubscribe
method to know whenever it was called or not - but it's only an idea. – Buczkowski