2020-02-25 11:32:38 -05:00
|
|
|
/**
|
|
|
|
* @license
|
2020-05-19 15:08:49 -04:00
|
|
|
* Copyright Google LLC All Rights Reserved.
|
2020-02-25 11:32:38 -05: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 23:57:39 -04:00
|
|
|
|
|
|
|
import {createDiagnostic, DiagnosticMessage} from '../src/diagnostic_messages';
|
2020-02-25 11:32:38 -05: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},
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|