I am unable to unsubscribe in my tests. Anyone else having this problem?? (am I doing anything wrong?)
Basic test:
describe('ngOnDestroy()', () => {
it('should unsubscribe if isLoggedInSub is defined', async(() => {
comp.ngOnInit();
fixture.detectChanges();
comp.ngOnDestroy();
fixture.detectChanges();
expect(comp.isLoggedInSub).not.toBeDefined();
}));
});
console error:
Uncaught Expected Subscriber({ closed: true, _parent: null, _parents: null, _subscriptions: null, syncErrorValue: null, syncErrorThrown: false, syncErrorThrowable: false, isStopped: true, destination: SafeSubscriber({ closed: false, _parent: null, _parents: null, _subscriptions: null, syncErrorValue: null, syncErrorThrown: false, syncErrorThrowable: false, isStopped: false, destination: Object({ closed: true, next: Function, error: Function, complete: Function }), _parentSubscriber: <circular reference: Object>, _context: <circular reference: Object>, _next: Function, _error: undefined, _complete: undefined }) }) not to be defined.
at Object.testing_3.async