Module: testBed
Functions
testBed
▸ testBed<T
, S
, R
>(config
): App
<T
, S
, R
>
Description
You can use testBed
to build your test code without render
(render
function is optional.).
Example
@injectable()
class Bar {
getValue() {
return 'bar';
}
}
@injectable()
class Foo {
constructor(public bar: Bar) {}
}
const foo = testBed({
modules: [{ provide: Bar, useValue: { getValue: () => 'test' } }],
main: Foo,
});
expect(foo.instance.bar.getValue()).toBe('test');
Type parameters
Name | Type |
---|---|
T | T |
S | extends any [] |
R | extends Renderer <S > |
Parameters
Name | Type |
---|---|
config | PartialKeys <Config <T , S , R >, "render" > |
Returns
App
<T
, S
, R
>