Added repo_url to function getRepoUrlFromLocationAnnotation
Signed-off-by: Dang Huynh <dhhuynh2@gmail.com>
This commit is contained in:
@@ -98,13 +98,13 @@ describe('helpers', () => {
|
||||
|
||||
describe('getRepoUrlFromLocationAnnotation', () => {
|
||||
it.each`
|
||||
url | repo_url | edit_uri
|
||||
${'https://github.com/backstage/backstage'} | ${'https://github.com/backstage/backstage'} | ${undefined}
|
||||
${'https://github.com/backstage/backstage/tree/main/examples/techdocs/'} | ${undefined} | ${'https://github.com/backstage/backstage/edit/main/examples/techdocs/docs'}
|
||||
${'https://github.com/backstage/backstage/tree/main/'} | ${undefined} | ${'https://github.com/backstage/backstage/edit/main/docs'}
|
||||
${'https://gitlab.com/backstage/backstage'} | ${'https://gitlab.com/backstage/backstage'} | ${undefined}
|
||||
${'https://gitlab.com/backstage/backstage/-/blob/main/examples/techdocs/'} | ${undefined} | ${'https://gitlab.com/backstage/backstage/-/edit/main/examples/techdocs/docs'}
|
||||
${'https://gitlab.com/backstage/backstage/-/blob/main/'} | ${undefined} | ${'https://gitlab.com/backstage/backstage/-/edit/main/docs'}
|
||||
url | repo_url | edit_uri
|
||||
${'https://github.com/backstage/backstage'} | ${'https://github.com/backstage/backstage'} | ${undefined}
|
||||
${'https://github.com/backstage/backstage/tree/main/examples/techdocs/'} | ${'https://github.com/backstage/backstage/tree/main/examples/techdocs/'} | ${'https://github.com/backstage/backstage/edit/main/examples/techdocs/docs'}
|
||||
${'https://github.com/backstage/backstage/tree/main/'} | ${'https://github.com/backstage/backstage/tree/main/'} | ${'https://github.com/backstage/backstage/edit/main/docs'}
|
||||
${'https://gitlab.com/backstage/backstage'} | ${'https://gitlab.com/backstage/backstage'} | ${undefined}
|
||||
${'https://gitlab.com/backstage/backstage/-/blob/main/examples/techdocs/'} | ${'https://gitlab.com/backstage/backstage/-/blob/main/examples/techdocs/'} | ${'https://gitlab.com/backstage/backstage/-/edit/main/examples/techdocs/docs'}
|
||||
${'https://gitlab.com/backstage/backstage/-/blob/main/'} | ${'https://gitlab.com/backstage/backstage/-/blob/main/'} | ${'https://gitlab.com/backstage/backstage/-/edit/main/docs'}
|
||||
`('should convert $url', ({ url: target, repo_url, edit_uri }) => {
|
||||
const parsedLocationAnnotation: ParsedLocationAnnotation = {
|
||||
type: 'url',
|
||||
@@ -120,14 +120,14 @@ describe('helpers', () => {
|
||||
});
|
||||
|
||||
it.each`
|
||||
url | edit_uri
|
||||
${'https://github.com/backstage/backstage/tree/main/examples/techdocs/'} | ${'https://github.com/backstage/backstage/edit/main/examples/techdocs/custom/folder'}
|
||||
${'https://github.com/backstage/backstage/tree/main/'} | ${'https://github.com/backstage/backstage/edit/main/custom/folder'}
|
||||
${'https://gitlab.com/backstage/backstage/-/blob/main/examples/techdocs/'} | ${'https://gitlab.com/backstage/backstage/-/edit/main/examples/techdocs/custom/folder'}
|
||||
${'https://gitlab.com/backstage/backstage/-/blob/main/'} | ${'https://gitlab.com/backstage/backstage/-/edit/main/custom/folder'}
|
||||
url | repo_url | edit_uri
|
||||
${'https://github.com/backstage/backstage/tree/main/examples/techdocs/'} | ${'https://github.com/backstage/backstage/tree/main/examples/techdocs/'} | ${'https://github.com/backstage/backstage/edit/main/examples/techdocs/custom/folder'}
|
||||
${'https://github.com/backstage/backstage/tree/main/'} | ${'https://github.com/backstage/backstage/tree/main/'} | ${'https://github.com/backstage/backstage/edit/main/custom/folder'}
|
||||
${'https://gitlab.com/backstage/backstage/-/blob/main/examples/techdocs/'} | ${'https://gitlab.com/backstage/backstage/-/blob/main/examples/techdocs/'} | ${'https://gitlab.com/backstage/backstage/-/edit/main/examples/techdocs/custom/folder'}
|
||||
${'https://gitlab.com/backstage/backstage/-/blob/main/'} | ${'https://gitlab.com/backstage/backstage/-/blob/main/'} | ${'https://gitlab.com/backstage/backstage/-/edit/main/custom/folder'}
|
||||
`(
|
||||
'should convert $url with custom docsFolder',
|
||||
({ url: target, edit_uri }) => {
|
||||
({ url: target, repo_url, edit_uri }) => {
|
||||
const parsedLocationAnnotation: ParsedLocationAnnotation = {
|
||||
type: 'url',
|
||||
target,
|
||||
@@ -139,7 +139,7 @@ describe('helpers', () => {
|
||||
scmIntegrations,
|
||||
'./custom/folder',
|
||||
),
|
||||
).toEqual({ edit_uri });
|
||||
).toEqual({ repo_url, edit_uri });
|
||||
},
|
||||
);
|
||||
|
||||
|
||||
@@ -114,7 +114,10 @@ export const getRepoUrlFromLocationAnnotation = (
|
||||
url: `./${docsFolder}`,
|
||||
base: target,
|
||||
});
|
||||
return { edit_uri: integration.resolveEditUrl(sourceFolder) };
|
||||
return {
|
||||
repo_url: target,
|
||||
edit_uri: integration.resolveEditUrl(sourceFolder),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user