done with deprecations in backend except BitBucketUrl
Signed-off-by: Simon <simme.jakobsson@gmail.com>
This commit is contained in:
@@ -171,7 +171,7 @@ describe('FetchUrlReader', () => {
|
||||
|
||||
describe('read', () => {
|
||||
it('should return etag from the response', async () => {
|
||||
const buffer = await fetchUrlReader.read(
|
||||
const buffer = await fetchUrlReader.readUrl(
|
||||
'https://backstage.io/some-resource',
|
||||
);
|
||||
expect(buffer.toString()).toBe('content foo');
|
||||
@@ -179,13 +179,13 @@ describe('FetchUrlReader', () => {
|
||||
|
||||
it('should throw NotFound if server responds with 404', async () => {
|
||||
await expect(
|
||||
fetchUrlReader.read('https://backstage.io/not-exists'),
|
||||
fetchUrlReader.readUrl('https://backstage.io/not-exists'),
|
||||
).rejects.toThrow(NotFoundError);
|
||||
});
|
||||
|
||||
it('should throw Error if server responds with 500', async () => {
|
||||
await expect(
|
||||
fetchUrlReader.read('https://backstage.io/error'),
|
||||
fetchUrlReader.readUrl('https://backstage.io/error'),
|
||||
).rejects.toThrow(Error);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -92,7 +92,7 @@ describe('GithubUrlReader', () => {
|
||||
describe('implementation', () => {
|
||||
it('rejects unknown targets', async () => {
|
||||
await expect(
|
||||
githubProcessor.read('https://not.github.com/apa'),
|
||||
githubProcessor.readUrl('https://not.github.com/apa'),
|
||||
).rejects.toThrow(
|
||||
'Incorrect URL: https://not.github.com/apa, Error: Invalid GitHub URL or file path',
|
||||
);
|
||||
@@ -135,7 +135,7 @@ describe('GithubUrlReader', () => {
|
||||
),
|
||||
);
|
||||
|
||||
await gheProcessor.read(
|
||||
await gheProcessor.readUrl(
|
||||
'https://github.com/backstage/mock/tree/blob/main',
|
||||
);
|
||||
});
|
||||
|
||||
@@ -150,7 +150,7 @@ describe('GitlabUrlReader', () => {
|
||||
treeResponseFactory,
|
||||
});
|
||||
|
||||
const data = await reader.read(url);
|
||||
const data = await reader.readUrl(url);
|
||||
const res = await JSON.parse(data.toString('utf-8'));
|
||||
expect(res).toEqual(response);
|
||||
});
|
||||
@@ -169,7 +169,7 @@ describe('GitlabUrlReader', () => {
|
||||
logger,
|
||||
treeResponseFactory,
|
||||
});
|
||||
await reader.read(url);
|
||||
await reader.readUrl(url);
|
||||
}).rejects.toThrow(error);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -41,7 +41,7 @@ describe('UrlReaderPredicateMux', () => {
|
||||
reader: barReader,
|
||||
});
|
||||
|
||||
await mux.read('http://foo/1');
|
||||
await mux.readUrl('http://foo/1');
|
||||
expect(fooReader.read).toHaveBeenCalledWith('http://foo/1');
|
||||
await mux.readUrl('http://foo/2');
|
||||
expect(fooReader.readUrl).toHaveBeenCalledWith('http://foo/2', undefined);
|
||||
@@ -50,7 +50,7 @@ describe('UrlReaderPredicateMux', () => {
|
||||
await mux.search('http://foo/4');
|
||||
expect(fooReader.search).toHaveBeenCalledWith('http://foo/4', undefined);
|
||||
|
||||
await mux.read('http://bar/1');
|
||||
await mux.readUrl('http://bar/1');
|
||||
expect(barReader.read).toHaveBeenCalledWith('http://bar/1');
|
||||
await mux.readUrl('http://bar/2');
|
||||
expect(barReader.readUrl).toHaveBeenCalledWith('http://bar/2', undefined);
|
||||
|
||||
@@ -50,7 +50,7 @@ export class UrlReaderPredicateMux implements UrlReader {
|
||||
|
||||
for (const { predicate, reader } of this.readers) {
|
||||
if (predicate(parsed)) {
|
||||
return reader.read(url);
|
||||
return reader.readUrl(url);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -89,7 +89,7 @@ describe.skip('UrlReaders', () => {
|
||||
it(
|
||||
'should read data from azure',
|
||||
withRetries(3, async () => {
|
||||
const data = await reader.read(
|
||||
const data = await reader.readUrl(
|
||||
'https://dev.azure.com/backstage-verification/test-templates/_git/test-templates?path=%2Ftemplate.yaml',
|
||||
);
|
||||
expect(data.toString()).toContain('test-template-azure');
|
||||
@@ -110,7 +110,7 @@ describe.skip('UrlReaders', () => {
|
||||
it(
|
||||
'should read data from gitlab',
|
||||
withRetries(3, async () => {
|
||||
const data = await reader.read(
|
||||
const data = await reader.readUrl(
|
||||
'https://gitlab.com/backstage-verification/test-templates/-/blob/master/template.yaml',
|
||||
);
|
||||
expect(data.toString()).toContain('test-template-gitlab');
|
||||
@@ -131,7 +131,7 @@ describe.skip('UrlReaders', () => {
|
||||
it(
|
||||
'should read data from bitbucket',
|
||||
withRetries(3, async () => {
|
||||
const data = await reader.read(
|
||||
const data = await reader.readUrl(
|
||||
'https://bitbucket.org/backstage-verification/test-template/src/master/template.yaml',
|
||||
);
|
||||
expect(data.toString()).toContain('test-template-bitbucket');
|
||||
@@ -152,7 +152,7 @@ describe.skip('UrlReaders', () => {
|
||||
it(
|
||||
'should read data from github',
|
||||
withRetries(3, async () => {
|
||||
const data = await reader.read(
|
||||
const data = await reader.readUrl(
|
||||
'https://github.com/backstage-verification/test-templates/blob/master/template.yaml',
|
||||
);
|
||||
expect(data.toString()).toContain('test-template-github');
|
||||
|
||||
Reference in New Issue
Block a user