From a1ef8f81e5901773ff00e834be67a30335c72d98 Mon Sep 17 00:00:00 2001 From: Ben Lesh Date: Sun, 17 Apr 2022 01:59:53 -0400 Subject: [PATCH] Remove more deprecated subscribes in tests (#6758) * chore: remove deprecated subscribe in min tests. * chore: Remove deprecated subscribe calls in Subject.create tests. --- spec/Subject-spec.ts | 22 ++++++------- spec/operators/min-spec.ts | 66 +++++++++++++++++++------------------- 2 files changed, 43 insertions(+), 45 deletions(-) diff --git a/spec/Subject-spec.ts b/spec/Subject-spec.ts index f6f68153bd..92919f1682 100644 --- a/spec/Subject-spec.ts +++ b/spec/Subject-spec.ts @@ -442,17 +442,16 @@ describe('Subject', () => { }, }; - const sub = Subject.create(destination, source); + const sub: Subject = Subject.create(destination, source); - sub.subscribe( - function (x: number) { + sub.subscribe({ + next: function (x: number) { output.push(x); }, - null, - () => { + complete: () => { outputComplete = true; } - ); + }); sub.next('a'); sub.next('b'); @@ -492,17 +491,16 @@ describe('Subject', () => { }, }; - const sub = Subject.create(destination, source); + const sub: Subject = Subject.create(destination, source); - sub.subscribe( - function (x: number) { + sub.subscribe({ + next: function (x: number) { output.push(x); }, - null, - () => { + complete: () => { outputComplete = true; } - ); + }); sub.next('a'); sub.next('b'); diff --git a/spec/operators/min-spec.ts b/spec/operators/min-spec.ts index e415da2f47..28c40688c4 100644 --- a/spec/operators/min-spec.ts +++ b/spec/operators/min-spec.ts @@ -90,45 +90,45 @@ describe('min', () => { }); it('should min a range() source observable', (done) => { - (range(1, 10000)).pipe(min()).subscribe( - (value: number) => { - expect(value).to.equal(1); - }, - (x: any) => { - done(new Error('should not be called')); - }, - () => { - done(); - } - ); + range(1, 10000) + .pipe(min()) + .subscribe({ + next: (value) => { + expect(value).to.equal(1); + }, + error: () => { + done(new Error('should not be called')); + }, + complete: done, + }); }); it('should min a range().skip(1) source observable', (done) => { - (range(1, 10)).pipe(skip(1), min()).subscribe( - (value: number) => { - expect(value).to.equal(2); - }, - (x: any) => { - done(new Error('should not be called')); - }, - () => { - done(); - } - ); + range(1, 10) + .pipe(skip(1), min()) + .subscribe({ + next: (value) => { + expect(value).to.equal(2); + }, + error: () => { + done(new Error('should not be called')); + }, + complete: done, + }); }); it('should min a range().take(1) source observable', (done) => { - (range(1, 10)).pipe(take(1), min()).subscribe( - (value: number) => { - expect(value).to.equal(1); - }, - (x: any) => { - done(new Error('should not be called')); - }, - () => { - done(); - } - ); + range(1, 10) + .pipe(take(1), min()) + .subscribe({ + next: (value) => { + expect(value).to.equal(1); + }, + error: () => { + done(new Error('should not be called')); + }, + complete: done, + }); }); it('should work with error', () => {