chore: move entityClient to createPlugin, mock entityClient in tests

This commit is contained in:
Marvin9
2020-10-29 14:33:09 +05:30
parent 097e3d222a
commit 55af83a78a
4 changed files with 59 additions and 44 deletions
@@ -21,7 +21,9 @@ import {
Publishers,
CreateReactAppTemplater,
Templaters,
CatalogEntityClient,
} from '@backstage/plugin-scaffolder-backend';
import { SingleHostDiscovery } from '@backstage/backend-common';
import type { PluginEnvironment } from '../types';
import Docker from 'dockerode';
@@ -40,6 +42,9 @@ export default async function createPlugin({
const dockerClient = new Docker();
const discovery = SingleHostDiscovery.fromConfig(config);
const entityClient = new CatalogEntityClient({ discovery });
return await createRouter({
preparers,
templaters,
@@ -47,5 +52,6 @@ export default async function createPlugin({
logger,
config,
dockerClient,
entityClient,
});
}