backend-app-api: rename services option to defaultServiceFactories
Signed-off-by: Vincenzo Scamporlino <vincenzos@spotify.com>
This commit is contained in:
committed by
Patrik Oldsberg
parent
d175692fd7
commit
966e376056
@@ -22,13 +22,15 @@ import { createSpecializedBackend } from './createSpecializedBackend';
|
||||
|
||||
describe('createSpecializedBackend', () => {
|
||||
it('should create a backend without services', () => {
|
||||
expect(() => createSpecializedBackend({ services: [] })).not.toThrow();
|
||||
expect(() =>
|
||||
createSpecializedBackend({ defaultServiceFactories: [] }),
|
||||
).not.toThrow();
|
||||
});
|
||||
|
||||
it('should throw on duplicate service implementations', () => {
|
||||
expect(() =>
|
||||
createSpecializedBackend({
|
||||
services: [
|
||||
defaultServiceFactories: [
|
||||
createServiceFactory({
|
||||
service: coreServices.rootLifecycle,
|
||||
deps: {},
|
||||
@@ -55,7 +57,7 @@ describe('createSpecializedBackend', () => {
|
||||
it('should throw when providing a plugin metadata service implementation', () => {
|
||||
expect(() =>
|
||||
createSpecializedBackend({
|
||||
services: [
|
||||
defaultServiceFactories: [
|
||||
createServiceFactory({
|
||||
service: coreServices.pluginMetadata,
|
||||
deps: {},
|
||||
|
||||
@@ -24,7 +24,7 @@ import { Backend, CreateSpecializedBackendOptions } from './types';
|
||||
export function createSpecializedBackend(
|
||||
options: CreateSpecializedBackendOptions,
|
||||
): Backend {
|
||||
const services = options.services.map(sf =>
|
||||
const services = options.defaultServiceFactories.map(sf =>
|
||||
typeof sf === 'function' ? sf() : sf,
|
||||
);
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ export interface Backend {
|
||||
* @public
|
||||
*/
|
||||
export interface CreateSpecializedBackendOptions {
|
||||
services: ServiceFactoryOrFunction[];
|
||||
defaultServiceFactories: ServiceFactoryOrFunction[];
|
||||
}
|
||||
|
||||
export interface ServiceHolder {
|
||||
|
||||
Reference in New Issue
Block a user