backend-test-utils: remove services from startTestBackend

Signed-off-by: Vincenzo Scamporlino <vincenzos@spotify.com>
This commit is contained in:
Vincenzo Scamporlino
2023-08-15 14:34:15 +02:00
committed by Patrik Oldsberg
parent 175e4c3516
commit f66d490332
31 changed files with 317 additions and 325 deletions
@@ -14,13 +14,13 @@
* limitations under the License.
*/
import { errorHandler, getVoidLogger } from '@backstage/backend-common';
import { ConfigReader } from '@backstage/config';
import { errorHandler } from '@backstage/backend-common';
import {
coreServices,
createBackendModule,
createServiceFactory,
} from '@backstage/backend-plugin-api';
import { startTestBackend } from '@backstage/backend-test-utils';
import { mockServices, startTestBackend } from '@backstage/backend-test-utils';
import { eventsExtensionPoint } from '@backstage/plugin-events-node/alpha';
import {
TestEventBroker,
@@ -38,14 +38,6 @@ describe('eventPlugin', () => {
const publisher = new TestEventPublisher();
const subscriber = new TestEventSubscriber('sub', ['fake']);
const config = new ConfigReader({
events: {
http: {
topics: ['fake'],
},
},
});
const httpRouter = Router();
httpRouter.use(express.json());
httpRouter.use(errorHandler());
@@ -70,12 +62,25 @@ describe('eventPlugin', () => {
await startTestBackend({
extensionPoints: [],
services: [
[coreServices.rootConfig, config],
[coreServices.httpRouter, httpRouter],
[coreServices.logger, getVoidLogger()],
features: [
eventsPlugin(),
testModule(),
mockServices.logger.factory(),
mockServices.rootConfig.factory({
data: {
events: {
http: {
topics: ['fake'],
},
},
},
}),
createServiceFactory({
service: coreServices.httpRouter,
deps: {},
factory: async () => httpRouter,
}),
],
features: [eventsPlugin(), testModule()],
});
expect(publisher.eventBroker).toBe(eventBroker);