ServiceFactoryTester.getService()
Home > @backstage/backend-test-utils
> ServiceFactoryTester
> getService
Return the service instance for any of the provided dependencies or built-in services.
Signature:
getService<TGetService, TGetScope extends 'root' | 'plugin', TGetInstances extends 'singleton' | 'multiton' = 'singleton'>(service: ServiceRef<TGetService, TGetScope, TGetInstances>, ...args: 'root' extends TGetScope ? [] : [pluginId?: string]): Promise<TGetInstances extends 'multiton' ? TGetService[] : TGetService>;
Parameters
Parameter |
Type |
Description |
---|---|---|
service |
ServiceRef<TGetService, TGetScope, TGetInstances> | |
args |
'root' extends TGetScope ? [] : [pluginId?: string] |
Promise<TGetInstances extends 'multiton' ? TGetService[] : TGetService>
Remarks
A plugin ID can optionally be provided for plugin scoped services, otherwise the plugin ID 'test' is used.