Skip to content

Commit 053cc46

Browse files
committed
test: add tests for . and .git in repo name
1 parent 4108501 commit 053cc46

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

tests/GitHelper.test.ts

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,40 @@ test('Testing - sanitizeRepoPathSsh from HTTPS', () => {
4848
).toBe('ssh://git@github.com:22/username/repository.git')
4949
})
5050

51+
test('Testing - sanitizeRepoPathSsh - name with dot', () => {
52+
expect(
53+
GitHelper.sanitizeRepoPathSsh(' github.com/owner/site.com ').repoPath
54+
).toBe('ssh://git@github.com:22/owner/site.com.git')
55+
})
56+
57+
test('Testing - sanitizeRepoPathSsh - name with dot and git suffix', () => {
58+
expect(
59+
GitHelper.sanitizeRepoPathSsh(' github.com/owner/site.com.git ')
60+
.repoPath
61+
).toBe('ssh://git@github.com:22/owner/site.com.git')
62+
})
63+
64+
test('Testing - sanitizeRepoPathSsh - name containing ".git"', () => {
65+
expect(
66+
GitHelper.sanitizeRepoPathSsh(' github.com/owner/repo.github ')
67+
.repoPath
68+
).toBe('ssh://git@github.com:22/owner/repo.github.git')
69+
})
70+
71+
test('Testing - sanitizeRepoPathSsh - name containing ".git" and git suffix', () => {
72+
expect(
73+
GitHelper.sanitizeRepoPathSsh(' github.com/owner/repo.github.git ')
74+
.repoPath
75+
).toBe('ssh://git@github.com:22/owner/repo.github.git')
76+
})
77+
78+
test('Testing - sanitizeRepoPathSsh - name containing ".git", git suffix and /', () => {
79+
expect(
80+
GitHelper.sanitizeRepoPathSsh(' github.com/owner/repo.github.git/ ')
81+
.repoPath
82+
).toBe('ssh://git@github.com:22/owner/repo.github.git')
83+
})
84+
5185
test('Testing - sanitizeRepoPathSsh - not git suffix', () => {
5286
expect(
5387
GitHelper.sanitizeRepoPathSsh(' github.com/owner/repository ').repoPath

0 commit comments

Comments
 (0)