backend-test-utils: include all core services in test backend

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
Patrik Oldsberg
2022-12-30 10:54:14 +01:00
parent 6518fbb3c8
commit a3ec2f32ea
3 changed files with 28 additions and 13 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/backend-test-utils': patch
---
The `startTestBackend` setup now includes default implementations for all core services.
@@ -17,10 +17,20 @@
import {
Backend,
createSpecializedBackend,
cacheFactory,
configFactory,
databaseFactory,
discoveryFactory,
httpRouterFactory,
lifecycleFactory,
rootLifecycleFactory,
loggerFactory,
permissionsFactory,
rootHttpRouterFactory,
rootLifecycleFactory,
rootLoggerFactory,
schedulerFactory,
tokenManagerFactory,
urlReaderFactory,
} from '@backstage/backend-app-api';
import {
ServiceFactory,
@@ -55,10 +65,20 @@ export interface TestBackendOptions<
}
const defaultServiceFactories = [
rootLoggerFactory(),
loggerFactory(),
cacheFactory(),
configFactory(),
databaseFactory(),
discoveryFactory(),
httpRouterFactory(),
lifecycleFactory(),
loggerFactory(),
permissionsFactory(),
rootHttpRouterFactory(),
rootLifecycleFactory(),
rootLoggerFactory(),
schedulerFactory(),
tokenManagerFactory(),
urlReaderFactory(),
];
const backendInstancesToCleanUp = new Array<Backend>();
@@ -20,12 +20,6 @@ import fetch from 'node-fetch';
import { coreServices } from '@backstage/backend-plugin-api';
import { startTestBackend } from '@backstage/backend-test-utils';
import { appPlugin } from './appPlugin';
import {
databaseFactory,
httpRouterFactory,
loggerFactory,
rootLoggerFactory,
} from '@backstage/backend-app-api';
import { ConfigReader } from '@backstage/config';
import getPort from 'get-port';
@@ -59,10 +53,6 @@ describe('appPlugin', () => {
},
}),
],
loggerFactory(),
rootLoggerFactory(),
databaseFactory(),
httpRouterFactory(),
],
features: [
appPlugin({