@@ -538,6 +538,7 @@ describe('Observable.prototype.concatMap', () => {
538
538
expectSubscriptions ( e1 . subscriptions ) . toBe ( e1subs ) ;
539
539
} ) ;
540
540
541
+ < < < << << HEAD
541
542
it ( 'should concatMap many outer to inner arrays, using resultSelector' , ( ) => {
542
543
const e1 = hot ( '2-----4--------3--------2-------|' ) ;
543
544
const e1subs = '^ !' ;
@@ -573,6 +574,8 @@ describe('Observable.prototype.concatMap', () => {
573
574
expectSubscriptions ( e1 . subscriptions ) . toBe ( e1subs ) ;
574
575
} ) ;
575
576
577
+ = === ===
578
+ >>> >>> > feat ( mergeMap | concatMap | concatMapTo ) : simplified the signatures
576
579
it ( 'should mergeMap many outer to inner arrays, outer unsubscribed early' , ( ) => {
577
580
const e1 = hot ( '2-----4--------3--------2-------|' ) ;
578
581
const e1subs = '^ ! ' ;
@@ -585,19 +588,6 @@ describe('Observable.prototype.concatMap', () => {
585
588
expectSubscriptions ( e1 . subscriptions ) . toBe ( e1subs ) ;
586
589
} ) ;
587
590
588
- it ( 'should concatMap many outer to inner arrays, resultSelector, outer unsubscribed' , ( ) => {
589
- const e1 = hot ( '2-----4--------3--------2-------|' ) ;
590
- const e1subs = '^ ! ' ;
591
- const unsub = ' ! ' ;
592
- const expected = '(44)--(8888)-- ' ;
593
-
594
- const result = e1 . concatMap ( ( value ) => arrayRepeat ( value , + value ) ,
595
- ( x , y ) => String ( parseInt ( x ) + parseInt ( y ) ) ) ;
596
-
597
- expectObservable ( result , unsub ) . toBe ( expected ) ;
598
- expectSubscriptions ( e1 . subscriptions ) . toBe ( e1subs ) ;
599
- } ) ;
600
-
601
591
it ( 'should concatMap many outer to inner arrays, project throws' , ( ) => {
602
592
const e1 = hot ( '2-----4--------3--------2-------|' ) ;
603
593
const e1subs = '^ ! ' ;
@@ -615,45 +605,7 @@ describe('Observable.prototype.concatMap', () => {
615
605
expectObservable ( result ) . toBe ( expected ) ;
616
606
expectSubscriptions ( e1 . subscriptions ) . toBe ( e1subs ) ;
617
607
} ) ;
618
-
619
- it ( 'should concatMap many outer to inner arrays, resultSelector throws' , ( ) => {
620
- const e1 = hot ( '2-----4--------3--------2-------|' ) ;
621
- const e1subs = '^ ! ' ;
622
- const expected = '(44)--(8888)---# ' ;
623
-
624
- const result = e1 . concatMap ( ( value ) => arrayRepeat ( value , + value ) ,
625
- ( inner , outer ) => {
626
- if ( outer === '3' ) {
627
- throw 'error' ;
628
- }
629
- return String ( parseInt ( outer ) + parseInt ( inner ) ) ;
630
- } ) ;
631
-
632
- expectObservable ( result ) . toBe ( expected ) ;
633
- expectSubscriptions ( e1 . subscriptions ) . toBe ( e1subs ) ;
634
- } ) ;
635
-
636
- it ( 'should concatMap many outer to inner arrays, resultSelector, project throws' , ( ) => {
637
- const e1 = hot ( '2-----4--------3--------2-------|' ) ;
638
- const e1subs = '^ ! ' ;
639
- const expected = '(44)--(8888)---# ' ;
640
-
641
- let invoked = 0 ;
642
- const result = e1 . concatMap ( ( value ) => {
643
- invoked ++ ;
644
- if ( invoked === 3 ) {
645
- throw 'error' ;
646
- }
647
- return arrayRepeat ( value , + value ) ;
648
- } , ( inner , outer ) => {
649
- return String ( parseInt ( outer ) + parseInt ( inner ) ) ;
650
- } ) ;
651
-
652
- expectObservable ( result ) . toBe ( expected ) ;
653
- expectSubscriptions ( e1 . subscriptions ) . toBe ( e1subs ) ;
654
- } ) ;
655
-
656
- it ( 'should map values to constant resolved promises and concatenate' , ( done ) => {
608
+ it ( 'should map values to constant resolved promises and concatenate' , ( done : MochaDone ) => {
657
609
const source = Rx . Observable . from ( [ 4 , 3 , 2 , 1 ] ) ;
658
610
const project = ( value : number ) => Observable . from ( Promise . resolve ( 42 ) ) ;
659
611
@@ -714,52 +666,4 @@ describe('Observable.prototype.concatMap', () => {
714
666
done ( new Error ( 'Subscriber complete handler not supposed to be called.' ) ) ;
715
667
} ) ;
716
668
} ) ;
717
-
718
- it ( 'should concatMap values to resolved promises with resultSelector' , ( done ) => {
719
- const source = Rx . Observable . from ( [ 4 , 3 , 2 , 1 ] ) ;
720
- const resultSelectorCalledWith : number [ ] [ ] = [ ] ;
721
- const project = ( value : number , index : number ) => Observable . from ( ( Promise . resolve ( [ value , index ] ) ) ) ;
722
-
723
- const resultSelector = function ( outerVal : any , innerVal : any , outerIndex : any , innerIndex : any ) : number {
724
- resultSelectorCalledWith . push ( [ ] . slice . call ( arguments ) ) ;
725
- return 8 ;
726
- } ;
727
-
728
- const results : number [ ] = [ ] ;
729
- const expectedCalls = [
730
- [ 4 , [ 4 , 0 ] , 0 , 0 ] ,
731
- [ 3 , [ 3 , 1 ] , 1 , 0 ] ,
732
- [ 2 , [ 2 , 2 ] , 2 , 0 ] ,
733
- [ 1 , [ 1 , 3 ] , 3 , 0 ]
734
- ] ;
735
- source . concatMap ( project , resultSelector ) . subscribe (
736
- ( x ) => {
737
- results . push ( x ) ;
738
- } , ( err ) => {
739
- done ( new Error ( 'Subscriber error handler not supposed to be called.' ) ) ;
740
- } , ( ) => {
741
- expect ( results ) . to . deep . equal ( [ 8 , 8 , 8 , 8 ] ) ;
742
- expect ( resultSelectorCalledWith ) . to . deep . equal ( expectedCalls ) ;
743
- done ( ) ;
744
- } ) ;
745
- } ) ;
746
-
747
- it ( 'should concatMap values to rejected promises with resultSelector' , ( done ) => {
748
- const source = Rx . Observable . from ( [ 4 , 3 , 2 , 1 ] ) ;
749
- const project = ( value : number , index : number ) => Observable . from ( Promise . reject ( '' + value + '-' + index ) ) ;
750
-
751
- const resultSelector = ( ) => {
752
- throw 'this should not be called' ;
753
- } ;
754
-
755
- source . concatMap ( project , resultSelector ) . subscribe (
756
- ( x ) => {
757
- done ( new Error ( 'Subscriber next handler not supposed to be called.' ) ) ;
758
- } , ( err ) => {
759
- expect ( err ) . to . deep . equal ( '4-0' ) ;
760
- done ( ) ;
761
- } , ( ) => {
762
- done ( new Error ( 'Subscriber complete handler not supposed to be called.' ) ) ;
763
- } ) ;
764
- } ) ;
765
669
} ) ;
0 commit comments