angular-docs-cn/packages/language-service/test/diagnostic_messages_spec.ts
Keen Yee Liau 1140bbc25c refactor(language-service): reformat using clang-format (#36426)
clang-format was recently updated and any PRs that touch files in the
language service will have to reformat all the files.

Instead of changing the formatting in those PRs, this PR formats all
files in language-service package once and for all.

PR Close #36426
2020-04-06 09:29:42 -07:00

30 lines
840 B
TypeScript

/**
* @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
*/
import * as ts from 'typescript';
import {createDiagnostic, DiagnosticMessage} from '../src/diagnostic_messages';
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},
});
});
});