backend-app-api: fix for test not making root lifecycle service available
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
@@ -17,9 +17,11 @@
|
||||
import {
|
||||
createServiceRef,
|
||||
createServiceFactory,
|
||||
coreServices,
|
||||
} from '@backstage/backend-plugin-api';
|
||||
import { BackendInitializer } from './BackendInitializer';
|
||||
import { ServiceRegistry } from './ServiceRegistry';
|
||||
import { rootLifecycleServiceFactory } from '../services/implementations';
|
||||
|
||||
const rootRef = createServiceRef<{ x: number }>({
|
||||
id: '1',
|
||||
@@ -30,6 +32,16 @@ const pluginRef = createServiceRef<{ x: number }>({
|
||||
id: '2',
|
||||
});
|
||||
|
||||
class MockLogger {
|
||||
debug() {}
|
||||
info() {}
|
||||
warn() {}
|
||||
error() {}
|
||||
child() {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
describe('BackendInitializer', () => {
|
||||
it('should initialize root scoped services', async () => {
|
||||
const rootFactory = jest.fn();
|
||||
@@ -46,6 +58,12 @@ describe('BackendInitializer', () => {
|
||||
deps: {},
|
||||
factory: pluginFactory,
|
||||
})(),
|
||||
rootLifecycleServiceFactory(),
|
||||
createServiceFactory({
|
||||
service: coreServices.rootLogger,
|
||||
deps: {},
|
||||
factory: () => new MockLogger(),
|
||||
})(),
|
||||
]);
|
||||
|
||||
const init = new BackendInitializer(registry);
|
||||
|
||||
Reference in New Issue
Block a user