license import { of , range , zip } from 'rxjs' ; describe ( 'Observable.zip' , ( ) => { let log ; const constructorZone1 = Zone . current . fork ( { name : 'Constructor Zone1' } ) ; const subscriptionZone = Zone . current . fork ( { name : 'Subscription Zone' } ) ; beforeEach ( ( ) => { log = [ ] ; } ) ; it ( 'zip func callback should run in the correct zone' , ( ) => { const observable1 = constructorZone1 . run ( ( ) => { return range ( 1 , 3 ) ; } ) ; const observable2 = constructorZone1 . run ( ( ) => { return of ( 'foo' , 'bar' , 'beer' ) ; } ) ; const observable3 = constructorZone1 . run ( ( ) => { return zip ( observable1 , observable2 , function ( n , str ) { expect ( Zone . current . name ) . toEqual ( constructorZone1 . name ) ; return { n : n , str : str } ; } ) ; } ) ; subscriptionZone . run ( ( ) => { observable3 . subscribe ( ( result ) => { log . push ( result ) ; expect ( Zone . current . name ) . toEqual ( subscriptionZone . name ) ; } , ( ) => { fail ( 'should not call error' ) ; } , ( ) => { log . push ( 'completed' ) ; expect ( Zone . current . name ) . toEqual ( subscriptionZone . name ) ; } ) ; } ) ; expect ( log ) . toEqual ( [ { n : 1 , str : 'foo' } , { n : 2 , str : 'bar' } , { n : 3 , str : 'beer' } , 'completed' ] ) ; } ) ; } ) ;