From 5d16ce4ecd6e73dc113dc310cd860f54c05dd218 Mon Sep 17 00:00:00 2001 From: Nicholas Jamieson Date: Fri, 27 Jul 2018 21:59:58 +1000 Subject: [PATCH] chore(observeOn): fix skipped test Closes #2457 #2459 --- spec/operators/observeOn-spec.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/spec/operators/observeOn-spec.ts b/spec/operators/observeOn-spec.ts index 59f8deedfb..ed218db90c 100644 --- a/spec/operators/observeOn-spec.ts +++ b/spec/operators/observeOn-spec.ts @@ -83,7 +83,7 @@ describe('observeOn operator', () => { expectSubscriptions(e1.subscriptions).toBe(sub); }); - xit('should clean up subscriptions created by async scheduling (prevent memory leaks #2244)', (done) => { + it('should clean up subscriptions created by async scheduling (prevent memory leaks #2244)', (done) => { //HACK: Deep introspection to make sure we're cleaning up notifications in scheduling. // as the architecture changes, this test may become brittle. const results: number[] = []; @@ -104,7 +104,7 @@ describe('observeOn operator', () => { .subscribe( x => { const observeOnSubscriber = subscription._subscriptions[0]; - expect(observeOnSubscriber._subscriptions.length).to.equal(2); // 1 for the consumer, and one for the notification + expect(observeOnSubscriber._subscriptions.length).to.equal(2); // one for the consumer, and one for the notification expect(observeOnSubscriber._subscriptions[1].state.notification.kind) .to.equal('N'); expect(observeOnSubscriber._subscriptions[1].state.notification.value) @@ -114,10 +114,11 @@ describe('observeOn operator', () => { err => done(err), () => { // now that the last nexted value is done, there should only be a complete notification scheduled + // the consumer will have been unsubscribed via Subscriber#_parentSubscription const observeOnSubscriber = subscription._subscriptions[0]; - expect(observeOnSubscriber._subscriptions.length).to.equal(2); // 1 for the consumer, one for the complete notification + expect(observeOnSubscriber._subscriptions.length).to.equal(1); // one for the complete notification // only this completion notification should remain. - expect(observeOnSubscriber._subscriptions[1].state.notification.kind) + expect(observeOnSubscriber._subscriptions[0].state.notification.kind) .to.equal('C'); // After completion, the entire _subscriptions list is nulled out anyhow, so we can't test much further than this. expect(results).to.deep.equal([1, 2, 3]);