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:
armandocomellas1
2024-01-15 18:01:06 -06:00
parent 895f6ce17f
commit f5da6523c0
2 changed files with 28 additions and 1 deletions
+1 -1
View File
@@ -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();
});
});