integration: add some additional test cases for defaultScmResolveUrl

Signed-off-by: MT Lewis <mtlewis@users.noreply.github.com>
This commit is contained in:
MT Lewis
2024-03-07 14:17:56 +00:00
parent 3f56a14ff5
commit a2d559b346
+36
View File
@@ -88,6 +88,24 @@ describe('isValidHost', () => {
describe('defaultScmResolveUrl', () => {
it('works for relative paths and retains query params', () => {
expect(
defaultScmResolveUrl({
url: './b.yaml',
base: 'https://gitlab.com/groupA/teams/teamA/subgroupA/repoA/-/blob/branch/folder/',
}),
).toBe(
'https://gitlab.com/groupA/teams/teamA/subgroupA/repoA/-/blob/branch/folder/b.yaml',
);
expect(
defaultScmResolveUrl({
url: './b.yaml',
base: 'https://gitlab.com/groupA/teams/teamA/subgroupA/repoA/-/blob/branch/folder/subfolder',
}),
).toBe(
'https://gitlab.com/groupA/teams/teamA/subgroupA/repoA/-/blob/branch/folder/b.yaml',
);
expect(
defaultScmResolveUrl({
url: './b.yaml',
@@ -106,6 +124,24 @@ describe('defaultScmResolveUrl', () => {
'https://gitlab.com/groupA/teams/teamA/subgroupA/repoA/-/blob/branch/folder/b.yaml?at=master',
);
expect(
defaultScmResolveUrl({
url: 'b.yaml',
base: 'https://gitlab.com/groupA/teams/teamA/subgroupA/repoA/-/blob/branch/folder/',
}),
).toBe(
'https://gitlab.com/groupA/teams/teamA/subgroupA/repoA/-/blob/branch/folder/b.yaml',
);
expect(
defaultScmResolveUrl({
url: 'b.yaml',
base: 'https://gitlab.com/groupA/teams/teamA/subgroupA/repoA/-/blob/branch/folder/subfolder',
}),
).toBe(
'https://gitlab.com/groupA/teams/teamA/subgroupA/repoA/-/blob/branch/folder/b.yaml',
);
expect(
defaultScmResolveUrl({
url: 'b.yaml',