| 
									
										
										
										
											2019-03-22 09:42:52 +00:00
										 |  |  | /** | 
					
						
							|  |  |  |  * @license | 
					
						
							|  |  |  |  * Copyright Google Inc. All Rights Reserved. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * Use of this source code is governed by an MIT-style license that can be | 
					
						
							|  |  |  |  * found in the LICENSE file at https://angular.io/license
 | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | // #docregion angular-setup
 | 
					
						
							|  |  |  | import {TestBed} from '@angular/core/testing'; | 
					
						
							|  |  |  | import {createAngularJSTestingModule, createAngularTestingModule} from '@angular/upgrade/static/testing'; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-04-13 16:40:21 -07:00
										 |  |  | import {HeroesService, ng1AppModule, Ng2AppModule} from './module'; | 
					
						
							| 
									
										
										
										
											2019-03-22 09:42:52 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | const {module, inject} = (window as any).angular.mock; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | // #enddocregion angular-setup
 | 
					
						
							|  |  |  | describe('HeroesService (from Angular)', () => { | 
					
						
							|  |  |  |   // #docregion angular-setup
 | 
					
						
							|  |  |  |   beforeEach(() => { | 
					
						
							|  |  |  |     TestBed.configureTestingModule( | 
					
						
							|  |  |  |         {imports: [createAngularTestingModule([ng1AppModule.name]), Ng2AppModule]}); | 
					
						
							|  |  |  |   }); | 
					
						
							|  |  |  |   // #enddocregion angular-setup
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   // #docregion angular-spec
 | 
					
						
							|  |  |  |   it('should have access to the HeroesService', () => { | 
					
						
							| 
									
										
										
										
											2019-08-28 16:22:36 -07:00
										 |  |  |     const heroesService = TestBed.inject(HeroesService); | 
					
						
							| 
									
										
										
										
											2019-03-22 09:42:52 +00:00
										 |  |  |     expect(heroesService).toBeDefined(); | 
					
						
							|  |  |  |   }); | 
					
						
							|  |  |  |   // #enddocregion angular-spec
 | 
					
						
							|  |  |  | }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | describe('HeroesService (from AngularJS)', () => { | 
					
						
							|  |  |  |   // #docregion angularjs-setup
 | 
					
						
							|  |  |  |   beforeEach(module(createAngularJSTestingModule([Ng2AppModule]))); | 
					
						
							|  |  |  |   beforeEach(module(ng1AppModule.name)); | 
					
						
							|  |  |  |   // #enddocregion angularjs-setup
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   // #docregion angularjs-spec
 | 
					
						
							| 
									
										
										
										
											2020-04-13 16:40:21 -07:00
										 |  |  |   it('should have access to the HeroesService', inject((heroesService: HeroesService) => { | 
					
						
							|  |  |  |        expect(heroesService).toBeDefined(); | 
					
						
							|  |  |  |      })); | 
					
						
							| 
									
										
										
										
											2019-03-22 09:42:52 +00:00
										 |  |  |   // #enddocregion angularjs-spec
 | 
					
						
							|  |  |  | }); |