test(language-service): remove MockData from MockTypescriptHost (#32752)
Remove MockData from the constructor parameters of MockTypescriptHost since the entire Tour of Heroes (TOH) project is now loaded from disk. Added a new method `reset()` to MockTypescriptHost that is necessary to reset the state of the project before each spec if run to make sure previous overrides are cleared. PR Close #32752
This commit is contained in:

committed by
Andrew Kushnir

parent
0450f39625
commit
f3859ff2b9
@ -11,11 +11,10 @@ import * as ts from 'typescript';
|
||||
import {createLanguageService} from '../src/language_service';
|
||||
import {TypeScriptServiceHost} from '../src/typescript_host';
|
||||
|
||||
import {toh} from './test_data';
|
||||
import {MockTypescriptHost} from './test_utils';
|
||||
|
||||
describe('service without angular', () => {
|
||||
let mockHost = new MockTypescriptHost(['/app/main.ts', '/app/parsing-cases.ts'], toh);
|
||||
let mockHost = new MockTypescriptHost(['/app/main.ts', '/app/parsing-cases.ts']);
|
||||
mockHost.forgetAngular();
|
||||
let service = ts.createLanguageService(mockHost);
|
||||
let ngHost = new TypeScriptServiceHost(mockHost, service);
|
||||
@ -32,4 +31,4 @@ describe('service without angular', () => {
|
||||
it('should not crash a get definition',
|
||||
() => expect(() => ngService.getDefinitionAt(fileName, position)).not.toThrow());
|
||||
it('should not crash a hover', () => expect(() => ngService.getHoverAt(fileName, position)));
|
||||
});
|
||||
});
|
||||
|
Reference in New Issue
Block a user