backend-app-api: rename services option to defaultServiceFactories

Signed-off-by: Vincenzo Scamporlino <vincenzos@spotify.com>
This commit is contained in:
Vincenzo Scamporlino
2023-08-10 23:41:24 +02:00
committed by Patrik Oldsberg
parent d175692fd7
commit 966e376056
4 changed files with 12 additions and 6 deletions
@@ -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,
);
+1 -1
View File
@@ -34,7 +34,7 @@ export interface Backend {
* @public
*/
export interface CreateSpecializedBackendOptions {
services: ServiceFactoryOrFunction[];
defaultServiceFactories: ServiceFactoryOrFunction[];
}
export interface ServiceHolder {