Skip to main content

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​

NameType
TT
Sextends any[]
Rextends Renderer<S>

Parameters​

NameType
configPartialKeys<Config<T, S, R>, "render">

Returns​

App<T, S, R>

Defined in​

testBed.ts:33