| 
									
										
										
										
											2017-10-13 09:03:28 -07:00
										 |  |  | /** | 
					
						
							|  |  |  |  * @license | 
					
						
							| 
									
										
										
										
											2020-05-19 12:08:49 -07:00
										 |  |  |  * Copyright Google LLC All Rights Reserved. | 
					
						
							| 
									
										
										
										
											2017-10-13 09:03:28 -07:00
										 |  |  |  * | 
					
						
							|  |  |  |  * 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
 | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | import * as path from 'path'; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | import {setup} from './test_support'; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | describe('ngc_wrapped', () => { | 
					
						
							| 
									
										
										
										
											2018-12-04 17:22:19 -08:00
										 |  |  |   it('should work', () => { | 
					
						
							| 
									
										
										
										
											2019-06-20 12:50:54 -07:00
										 |  |  |     const {read, write, runOneBuild, writeConfig, shouldExist, basePath, typesRoots} = setup(); | 
					
						
							| 
									
										
										
										
											2017-10-13 09:03:28 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  |     write('some_project/index.ts', `
 | 
					
						
							|  |  |  |       import {Component} from '@angular/core'; | 
					
						
							| 
									
										
										
										
											2018-01-29 15:01:38 -08:00
										 |  |  |       import {a} from 'ambient_module'; | 
					
						
							| 
									
										
										
										
											2017-10-13 09:03:28 -07:00
										 |  |  |       console.log('works: ', Component); | 
					
						
							|  |  |  |     `);
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-06-20 12:50:54 -07:00
										 |  |  |     const typesFile = path.resolve(basePath, typesRoots, 'thing', 'index.d.ts'); | 
					
						
							| 
									
										
										
										
											2018-01-29 15:01:38 -08:00
										 |  |  | 
 | 
					
						
							|  |  |  |     write(typesFile, `
 | 
					
						
							|  |  |  |       declare module "ambient_module" { | 
					
						
							|  |  |  |         declare const a = 1; | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |     `);
 | 
					
						
							| 
									
										
										
										
											2017-10-13 09:03:28 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-06-20 12:50:54 -07:00
										 |  |  |     writeConfig({ | 
					
						
							|  |  |  |       srcTargetPath: 'some_project', | 
					
						
							|  |  |  |       depPaths: [path.dirname(typesFile)], | 
					
						
							|  |  |  |     }); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-13 09:03:28 -07:00
										 |  |  |     // expect no error
 | 
					
						
							|  |  |  |     expect(runOneBuild()).toBe(true); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     shouldExist('bazel-bin/some_project/index.js'); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     expect(read('bazel-bin/some_project/index.js')) | 
					
						
							|  |  |  |         .toContain(`console.log('works: ', core_1.Component);`); | 
					
						
							|  |  |  |   }); | 
					
						
							|  |  |  | }); |