| 
									
										
										
										
											2020-02-25 08:32:38 -08:00
										 |  |  | /** | 
					
						
							|  |  |  |  * @license | 
					
						
							| 
									
										
										
										
											2020-05-19 12:08:49 -07:00
										 |  |  |  * Copyright Google LLC All Rights Reserved. | 
					
						
							| 
									
										
										
										
											2020-02-25 08:32:38 -08: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 ts from 'typescript'; | 
					
						
							| 
									
										
										
										
											2020-04-03 20:57:39 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | import {createDiagnostic, DiagnosticMessage} from '../src/diagnostic_messages'; | 
					
						
							| 
									
										
										
										
											2020-02-25 08:32:38 -08:00
										 |  |  | 
 | 
					
						
							|  |  |  | describe('create diagnostic', () => { | 
					
						
							|  |  |  |   it('should format and create diagnostics correctly', () => { | 
					
						
							|  |  |  |     const diagnosticMessage: DiagnosticMessage = { | 
					
						
							|  |  |  |       message: 'Check that %1 contains %2', | 
					
						
							|  |  |  |       kind: 'Error', | 
					
						
							|  |  |  |     }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     const diagnostic = | 
					
						
							|  |  |  |         createDiagnostic({start: 0, end: 1}, diagnosticMessage, 'testCls', 'testMethod'); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     expect(diagnostic).toEqual({ | 
					
						
							|  |  |  |       kind: ts.DiagnosticCategory.Error, | 
					
						
							|  |  |  |       message: 'Check that testCls contains testMethod', | 
					
						
							|  |  |  |       span: {start: 0, end: 1}, | 
					
						
							|  |  |  |     }); | 
					
						
							|  |  |  |   }); | 
					
						
							|  |  |  | }); |