test: add test to parse GitLab/Bitbucket URLs with groups
This commit is contained in:
parent
2edd9da598
commit
053c9edf9b
@ -29,6 +29,14 @@ test.serial(
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
test.serial('Handle "https" URL with group and subgroup', t => {
|
||||||
|
t.is(getAuthUrl('https://host.com/group/subgroup/owner/repo.git'), 'https://host.com/group/subgroup/owner/repo.git');
|
||||||
|
});
|
||||||
|
|
||||||
|
test.serial('Handle "git" URL with group and subgroup', t => {
|
||||||
|
t.is(getAuthUrl('git@host.com:group/subgroup/owner/repo.git'), 'git@host.com:group/subgroup/owner/repo.git');
|
||||||
|
});
|
||||||
|
|
||||||
test.serial('Return the "https" formatted URL if "gitCredentials" is defined and repositoryUrl is a "git" URL', t => {
|
test.serial('Return the "https" formatted URL if "gitCredentials" is defined and repositoryUrl is a "git" URL', t => {
|
||||||
process.env.GIT_CREDENTIALS = 'user:pass';
|
process.env.GIT_CREDENTIALS = 'user:pass';
|
||||||
t.is(getAuthUrl('git@host.com:owner/repo.git'), 'https://user:pass@host.com/owner/repo.git');
|
t.is(getAuthUrl('git@host.com:owner/repo.git'), 'https://user:pass@host.com/owner/repo.git');
|
||||||
@ -79,3 +87,19 @@ test.serial('Return the "https" formatted URL if "gitCredentials" is defined wit
|
|||||||
process.env.GITLAB_TOKEN = 'token';
|
process.env.GITLAB_TOKEN = 'token';
|
||||||
t.is(getAuthUrl('git@host.com:owner/repo.git'), 'https://gitlab-ci-token:token@host.com/owner/repo.git');
|
t.is(getAuthUrl('git@host.com:owner/repo.git'), 'https://gitlab-ci-token:token@host.com/owner/repo.git');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test.serial('Handle "https" URL with group and subgroup, with "GIT_CREDENTIALS"', t => {
|
||||||
|
process.env.GIT_CREDENTIALS = 'user:pass';
|
||||||
|
t.is(
|
||||||
|
getAuthUrl('https://host.com/group/subgroup/owner/repo.git'),
|
||||||
|
'https://user:pass@host.com/group/subgroup/owner/repo.git'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
test.serial('Handle "git" URL with group and subgroup, with "GIT_CREDENTIALS', t => {
|
||||||
|
process.env.GIT_CREDENTIALS = 'user:pass';
|
||||||
|
t.is(
|
||||||
|
getAuthUrl('git@host.com:group/subgroup/owner/repo.git'),
|
||||||
|
'https://user:pass@host.com/group/subgroup/owner/repo.git'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user