1- import { expect } from 'chai' ;
1+ import { expect } from 'chai' ;
22import * as Rx from '../../dist/cjs/Rx' ;
3- import { subscribeToResult } from '../../dist/cjs/util/subscribeToResult' ;
4- import { OuterSubscriber } from '../../dist/cjs/OuterSubscriber' ;
5- import { $$iterator } from '../../dist/cjs/symbol/iterator' ;
3+ import { subscribeToResult } from '../../dist/cjs/util/subscribeToResult' ;
4+ import { OuterSubscriber } from '../../dist/cjs/OuterSubscriber' ;
5+ import { $$iterator } from '../../dist/cjs/symbol/iterator' ;
66import $$symbolObservable from 'symbol-observable' ;
7+ import { Observable } from '../../dist/cjs/Observable' ;
8+ import { Subject } from '../../dist/cjs/Subject' ;
79
810describe ( 'subscribeToResult' , ( ) => {
911 it ( 'should synchronously complete when subscribe to scalarObservable' , ( ) => {
@@ -59,7 +61,7 @@ describe('subscribeToResult', () => {
5961 } ) ;
6062
6163 it ( 'should subscribe to an array-like and emit synchronously' , ( ) => {
62- const result = { 0 : 0 , 1 : 1 , 2 : 2 , length : 3 } ;
64+ const result = { 0 : 0 , 1 : 1 , 2 : 2 , length : 3 } ;
6365 const expected = [ ] ;
6466
6567 const subscriber = new OuterSubscriber ( x => expected . push ( x ) ) ;
@@ -105,12 +107,13 @@ describe('subscribeToResult', () => {
105107
106108 const iterable = {
107109 [ $$iterator ] : ( ) => {
108- return {
109- next : ( ) => {
110- return iteratorResults . shift ( ) ;
111- }
112- } ;
113- } } ;
110+ return {
111+ next : ( ) => {
112+ return iteratorResults . shift ( ) ;
113+ }
114+ } ;
115+ }
116+ } ;
114117
115118 const subscriber = new OuterSubscriber ( ( x : number ) => expected = x ) ;
116119
@@ -177,4 +180,14 @@ describe('subscribeToResult', () => {
177180
178181 subscribeToResult ( subscriber , null ) ;
179182 } ) ;
183+
184+ it ( 'should not swallow exception in inner subscriber' , ( ) => {
185+ const source = new Subject ( ) ;
186+
187+ source . mergeMapTo ( Observable . of ( 1 , 2 , 3 ) ) . subscribe ( ( ) => {
188+ throw new Error ( 'meh' ) ;
189+ } ) ;
190+
191+ expect ( ( ) => source . next ( ) ) . to . throw ( ) ;
192+ } ) ;
180193} ) ;
0 commit comments