TechDocs: Update tests with mock url reader

This commit is contained in:
Himanshu Mishra
2021-01-28 15:27:39 +01:00
parent f0320190d7
commit 03a2d95c71
2 changed files with 30 additions and 5 deletions
@@ -17,6 +17,7 @@
import {
createServiceBuilder,
SingleHostDiscovery,
UrlReader,
} from '@backstage/backend-common';
import { Server } from 'http';
import { Logger } from 'winston';
@@ -49,10 +50,18 @@ export async function startStandaloneServer(
},
});
const discovery = SingleHostDiscovery.fromConfig(config);
const mockUrlReader: jest.Mocked<UrlReader> = {
read: jest.fn(),
readTree: jest.fn(),
};
logger.debug('Creating application...');
const preparers = new Preparers();
const directoryPreparer = new DirectoryPreparer(config, logger);
const directoryPreparer = new DirectoryPreparer(
config,
logger,
mockUrlReader,
);
preparers.register('dir', directoryPreparer);
const generators = new Generators();