Change the description header of the changeset and also add a unit test for new URL method
Signed-off-by: armandocomellas1 <cgarmando@google.com>
This commit is contained in:
@@ -2,4 +2,4 @@
|
||||
'@backstage/plugin-catalog-backend': patch
|
||||
---
|
||||
|
||||
Change script in **UrlReaderProcessor.ts** Replacing the line code 127 with method (new URL) to handle URL Reader from GCS with wildcard \*
|
||||
Parse the URL using a different method rather than `git-url-parse` to support wildcards for URLs which are not VCS providers
|
||||
|
||||
@@ -213,4 +213,31 @@ describe('UrlReaderProcessor', () => {
|
||||
|
||||
expect(reader.search).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
it('parser return valid URL with wildcard *', async () => {
|
||||
const logger = getVoidLogger();
|
||||
|
||||
const reader: jest.Mocked<UrlReader> = {
|
||||
readUrl: jest.fn(),
|
||||
readTree: jest.fn(),
|
||||
search: jest.fn().mockImplementation(async () => []),
|
||||
};
|
||||
|
||||
const processor = new UrlReaderProcessor({ reader, logger });
|
||||
|
||||
const emit = jest.fn();
|
||||
|
||||
await processor.readLocation(
|
||||
{
|
||||
type: 'url',
|
||||
target: 'https://storage.cloud.google.com/ah-backstage-poc-catalog/*',
|
||||
},
|
||||
false,
|
||||
emit,
|
||||
defaultEntityDataParser,
|
||||
mockCache,
|
||||
);
|
||||
|
||||
expect(reader.search).toHaveReturned();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user