From b817f539b9696bd7afd0dfab8aeb1ee0b5278c44 Mon Sep 17 00:00:00 2001 From: Nicholas Jamieson Date: Sat, 22 Sep 2018 09:41:51 +1000 Subject: [PATCH] chore(test): simplify mergeMap test Remove the mapTo and the concat to reduce the number of subscribers to make the test easier to reason with. --- spec/operators/mergeMap-spec.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/spec/operators/mergeMap-spec.ts b/spec/operators/mergeMap-spec.ts index 5af05847de..cb21aff151 100644 --- a/spec/operators/mergeMap-spec.ts +++ b/spec/operators/mergeMap-spec.ts @@ -1,6 +1,6 @@ import { expect } from 'chai'; -import { mergeMap, map, mapTo } from 'rxjs/operators'; -import { asapScheduler, concat, defer, Observable, from, of, timer } from 'rxjs'; +import { mergeMap, map } from 'rxjs/operators'; +import { asapScheduler, defer, Observable, from, of, timer } from 'rxjs'; import { hot, cold, expectObservable, expectSubscriptions } from '../helpers/marble-testing'; declare const type: Function; @@ -772,18 +772,18 @@ describe('mergeMap', () => { const results: (number | string)[] = []; const wrapped = new Observable(subscriber => { - const subscription = timer(0, asapScheduler).pipe(mapTo(42)).subscribe(subscriber); + const subscription = timer(0, asapScheduler).subscribe(subscriber); return () => subscription.unsubscribe(); }); wrapped.pipe( - mergeMap(value => concat(of(value), timer(0, asapScheduler).pipe(mapTo(value)))) + mergeMap(() => timer(0, asapScheduler)) ).subscribe({ next(value) { results.push(value); }, complete() { results.push('done'); } }); setTimeout(() => { - expect(results).to.deep.equal([42, 42, 'done']); + expect(results).to.deep.equal([0, 'done']); done(); }, 0); });