Compare commits

...
2 Commits
2 changed files with 25 additions and 1 deletions
+1 -1
View File
@@ -33,7 +33,7 @@
"execa": "^0.9.0",
"get-stream": "^3.0.0",
"git-log-parser": "^1.2.0",
"git-url-parse": "^8.0.0",
"git-url-parse": "^8.1.0",
"hook-std": "^0.4.0",
"lodash": "^4.17.4",
"marked": "^0.3.9",
+24
View File
@@ -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 => {
process.env.GIT_CREDENTIALS = 'user:pass';
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';
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'
);
});