test: make NgMatchers type-aware (#19904)

PR Close #19904
This commit is contained in:
George Kalpakas
2018-07-05 15:24:53 +03:00
committed by Miško Hevery
parent 00c110b055
commit 809e8f742e
9 changed files with 39 additions and 59 deletions

View File

@ -217,7 +217,7 @@ function factoryFn(a: any){}
const injector = Injector.create([CarWithOptionalEngine.PROVIDER]);
const car = injector.get<CarWithOptionalEngine>(CarWithOptionalEngine);
expect(car.engine).toEqual(null);
expect(car.engine).toBeNull();
});
it('should flatten passed-in providers', () => {
@ -288,8 +288,8 @@ function factoryFn(a: any){}
Injector.create([CarWithDashboard.PROVIDER, Engine.PROVIDER, Dashboard.PROVIDER]);
expect(() => injector.get(CarWithDashboard))
.toThrowError(
`StaticInjectorError[${stringify(CarWithDashboard)} -> ${stringify(Dashboard)} -> DashboardSoftware]:
NullInjectorError: No provider for DashboardSoftware!`);
`StaticInjectorError[${stringify(CarWithDashboard)} -> ${stringify(Dashboard)} -> DashboardSoftware]: \n` +
' NullInjectorError: No provider for DashboardSoftware!');
});
it('should throw when trying to instantiate a cyclic dependency', () => {
@ -415,8 +415,9 @@ function factoryFn(a: any){}
parent);
expect(() => child.get(Car))
.toThrowError(`StaticInjectorError[${stringify(Car)} -> ${stringify(Engine)}]:
NullInjectorError: No provider for Engine!`);
.toThrowError(
`StaticInjectorError[${stringify(Car)} -> ${stringify(Engine)}]: \n` +
' NullInjectorError: No provider for Engine!');
});
});