license import { ifEnvSupports } from './test-util' ; function supportJasmineSpec ( ) { return jasmine && ( jasmine as any ) [ 'Spec' ] ; } ( supportJasmineSpec as any ) . message = 'jasmine spec' ; ifEnvSupports ( supportJasmineSpec , ( ) => { beforeEach ( ( ) => { expect ( Zone . currentTask ) . toBeTruthy ( ) ; } ) ; describe ( 'jasmine' , ( ) => { let throwOnAsync = false ; let beforeEachZone = null ; let beforeAllZone = null ; let itZone = null ; const syncZone = Zone . current ; try { Zone . current . scheduleMicroTask ( 'dontallow' , ( ) : any => null ) ; } catch ( e ) { throwOnAsync = true ; } beforeAll ( ( ) => beforeAllZone = Zone . current ) ; beforeEach ( ( ) => beforeEachZone = Zone . current ) ; it ( 'should throw on async in describe' , ( ) => { expect ( throwOnAsync ) . toBe ( true ) ; expect ( syncZone . name ) . toEqual ( 'syncTestZone for jasmine.describe' ) ; itZone = Zone . current ; } ) ; it ( 'should cope with pending tests, which have no test body' ) ; afterEach ( ( ) => { let zone = Zone . current ; expect ( zone . name ) . toEqual ( 'ProxyZone' ) ; expect ( beforeEachZone ! . name ) . toEqual ( zone . name ) ; expect ( itZone ) . toBe ( zone ) ; } ) ; afterAll ( ( ) => { let zone = Zone . current ; expect ( zone . name ) . toEqual ( 'ProxyZone' ) ; expect ( beforeAllZone ! . name ) . toEqual ( zone . name ) ; } ) ; } ) ; describe ( 'return promise' , ( ) => { let log ; beforeEach ( ( ) => { log = [ ] ; } ) ; it ( 'should wait for promise to resolve' , ( ) => { return new Promise ( ( res , _ ) => { setTimeout ( ( ) => { log . push ( 'resolved' ) ; res ( ) ; } , 100 ) ; } ) ; } ) ; afterEach ( ( ) => { expect ( log ) . toEqual ( [ 'resolved' ] ) ; } ) ; } ) ; } ) ( ) ;