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:
Keen Yee Liau
2019-09-17 14:33:41 -07:00
committed by Andrew Kushnir
parent 0450f39625
commit f3859ff2b9
12 changed files with 64 additions and 343 deletions

View File

@ -9,11 +9,10 @@
import 'reflect-metadata';
import * as ts from 'typescript';
import {create} from '../src/ts_plugin';
import {toh} from './test_data';
import {MockTypescriptHost} from './test_utils';
describe('plugin', () => {
const mockHost = new MockTypescriptHost(['/app/main.ts', '/app/parsing-cases.ts'], toh);
const mockHost = new MockTypescriptHost(['/app/main.ts', '/app/parsing-cases.ts']);
const service = ts.createLanguageService(mockHost);
const program = service.getProgram();
const plugin = createPlugin(service, mockHost);