Merge pull request #15506 from backstage/jhaals/remove-read
backend-common: Remove read method from UrlReader
This commit is contained in:
@@ -255,7 +255,6 @@ describe('replaceReadme', () => {
|
||||
}),
|
||||
readTree: jest.fn(),
|
||||
search: jest.fn(),
|
||||
read: jest.fn(),
|
||||
};
|
||||
|
||||
const result = await replaceReadme(
|
||||
|
||||
@@ -84,10 +84,14 @@ export class OpenApiRefProcessor implements CatalogProcessor {
|
||||
|
||||
this.logger.debug(`Bundling OpenAPI specification from ${location.target}`);
|
||||
try {
|
||||
const read = async (url: string) => {
|
||||
const { buffer } = await this.reader.readUrl(url);
|
||||
return await buffer();
|
||||
};
|
||||
const bundledSpec = await bundleFileWithRefs(
|
||||
definition.toString(),
|
||||
location.target,
|
||||
this.reader.read,
|
||||
read,
|
||||
resolveUrl,
|
||||
);
|
||||
|
||||
|
||||
@@ -32,7 +32,6 @@ const integrations = ScmIntegrations.fromConfig(new ConfigReader({}));
|
||||
|
||||
describe('PlaceholderProcessor', () => {
|
||||
const reader: jest.Mocked<UrlReader> = {
|
||||
read: jest.fn(),
|
||||
readTree: jest.fn(),
|
||||
search: jest.fn(),
|
||||
readUrl: jest.fn(),
|
||||
|
||||
@@ -194,7 +194,6 @@ describe('UrlReaderProcessor', () => {
|
||||
const logger = getVoidLogger();
|
||||
|
||||
const reader: jest.Mocked<UrlReader> = {
|
||||
read: jest.fn(),
|
||||
readUrl: jest.fn(),
|
||||
readTree: jest.fn(),
|
||||
search: jest.fn().mockImplementation(async () => []),
|
||||
|
||||
@@ -75,7 +75,6 @@ describe('fetch:cookiecutter', () => {
|
||||
|
||||
const mockReader: UrlReader = {
|
||||
readUrl: jest.fn(),
|
||||
read: jest.fn(),
|
||||
readTree: jest.fn(),
|
||||
search: jest.fn(),
|
||||
};
|
||||
|
||||
@@ -74,7 +74,6 @@ describe('fetch:rails', () => {
|
||||
};
|
||||
|
||||
const mockReader: UrlReader = {
|
||||
read: jest.fn(),
|
||||
readUrl: jest.fn(),
|
||||
readTree: jest.fn(),
|
||||
search: jest.fn(),
|
||||
|
||||
@@ -39,7 +39,6 @@ describe('fetchContent helper', () => {
|
||||
|
||||
const readTree = jest.fn();
|
||||
const reader: UrlReader = {
|
||||
read: jest.fn(),
|
||||
readUrl: jest.fn(),
|
||||
readTree,
|
||||
search: jest.fn(),
|
||||
|
||||
@@ -34,7 +34,6 @@ describe('fetch:plain', () => {
|
||||
);
|
||||
const reader: UrlReader = {
|
||||
readUrl: jest.fn(),
|
||||
read: jest.fn(),
|
||||
readTree: jest.fn(),
|
||||
search: jest.fn(),
|
||||
};
|
||||
|
||||
@@ -53,7 +53,6 @@ describe('DefaultCatalogCollatorFactory', () => {
|
||||
readable._read = () => {};
|
||||
reader = {
|
||||
search: jest.fn(),
|
||||
read: jest.fn(),
|
||||
readTree: jest.fn(),
|
||||
readUrl: jest.fn(),
|
||||
};
|
||||
|
||||
@@ -53,7 +53,6 @@ export async function startStandaloneServer(
|
||||
});
|
||||
const discovery = SingleHostDiscovery.fromConfig(config);
|
||||
const mockUrlReader: jest.Mocked<UrlReader> = {
|
||||
read: jest.fn(),
|
||||
readUrl: jest.fn(),
|
||||
readTree: jest.fn(),
|
||||
search: jest.fn(),
|
||||
|
||||
@@ -45,7 +45,6 @@ const createMockEntity = (annotations: {}) => {
|
||||
|
||||
const mockConfig = new ConfigReader({});
|
||||
const mockUrlReader: jest.Mocked<UrlReader> = {
|
||||
read: jest.fn(),
|
||||
readUrl: jest.fn(),
|
||||
readTree: jest.fn(),
|
||||
search: jest.fn(),
|
||||
|
||||
Reference in New Issue
Block a user