techdocs: fix tests by reusing the instantiated discovery

This commit is contained in:
Himanshu Mishra
2021-01-24 13:01:11 +01:00
parent e44925723e
commit 38469b66bf
2 changed files with 3 additions and 9 deletions
@@ -26,10 +26,7 @@ import {
PublisherBase,
getLocationForEntity,
} from '@backstage/techdocs-common';
import {
PluginEndpointDiscovery,
SingleHostDiscovery,
} from '@backstage/backend-common';
import { PluginEndpointDiscovery } from '@backstage/backend-common';
import { Entity } from '@backstage/catalog-model';
import { getEntityNameFromUrlPath } from './helpers';
import { DocsBuilder } from '../DocsBuilder';
@@ -105,10 +102,9 @@ export async function createRouter({
router.get('/docs/:namespace/:kind/:name/*', async (req, res) => {
const { kind, namespace, name } = req.params;
const discoveryApi = SingleHostDiscovery.fromConfig(config);
const storageUrl =
config.getOptionalString('techdocs.storageUrl') ??
`${await discoveryApi.getBaseUrl('techdocs')}/static/docs`;
`${await discovery.getBaseUrl('techdocs')}/static/docs`;
const catalogUrl = await discovery.getBaseUrl('catalog');
const triple = [kind, namespace, name].map(encodeURIComponent).join('/');