1
+ /**
2
+ * @license
3
+ * Copyright Google Inc. All Rights Reserved.
4
+ *
5
+ * Use of this source code is governed by an MIT-style license that can be
6
+ * found in the LICENSE file at https://angular.io/license
7
+ */
8
+
9
+ import * as ts from 'typescript' ;
10
+
11
+ import { createLanguageService } from '../src/language_service' ;
12
+ import { Completions , LanguageService } from '../src/types' ;
13
+ import { TypeScriptServiceHost } from '../src/typescript_host' ;
14
+
15
+ import { toh } from './test_data' ;
16
+ import { MockTypescriptHost } from './test_utils' ;
17
+
18
+ describe ( 'service without angular' , ( ) => {
19
+ let mockHost = new MockTypescriptHost ( [ '/app/main.ts' , '/app/parsing-cases.ts' ] , toh ) ;
20
+ mockHost . forgetAngular ( ) ;
21
+ let service = ts . createLanguageService ( mockHost ) ;
22
+ let ngHost = new TypeScriptServiceHost ( mockHost , service ) ;
23
+ let ngService = createLanguageService ( ngHost ) ;
24
+ const fileName = '/app/test.ng' ;
25
+ let position = mockHost . getMarkerLocations ( fileName ) [ 'h1-content' ] ;
26
+
27
+ it ( 'should not crash a get template references' ,
28
+ ( ) => expect ( ( ) => ngService . getTemplateReferences ( ) ) ) ;
29
+ it ( 'should not crash a get dianostics' ,
30
+ ( ) => expect ( ( ) => ngService . getDiagnostics ( fileName ) ) . not . toThrow ( ) ) ;
31
+ it ( 'should not crash a completion' ,
32
+ ( ) => expect ( ( ) => ngService . getCompletionsAt ( fileName , position ) ) . not . toThrow ( ) ) ;
33
+ it ( 'should not crash a get defintion' ,
34
+ ( ) => expect ( ( ) => ngService . getDefinitionAt ( fileName , position ) ) . not . toThrow ( ) ) ;
35
+ it ( 'should not crash a hover' , ( ) => expect ( ( ) => ngService . getHoverAt ( fileName , position ) ) ) ;
36
+ } ) ;
0 commit comments