Skip to content

Commit 4e3b1cc

Browse files
committed
Merge branch 'custom-ssh-user-tests' of github.com:privatenumber/git-url-parse into new-version
2 parents 32ed275 + 7cce252 commit 4e3b1cc

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

test/index.js

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,18 @@ const gitUrlParse = require("..")
55

66
// Constants
77
const URLS = {
8-
ssh: "git@github.com:42IonicaBizau/git-url-parse"
8+
ssh: "custom-user@github.com:42IonicaBizau/git-url-parse"
99
, https: "https://github.com/42IonicaBizau/git-url-parse"
1010
, ftp: "ftp://github.com/42IonicaBizau/git-url-parse"
1111
, ftps: "ftps://github.com/42IonicaBizau/git-url-parse"
12-
, gitSsh: "git+ssh://git@github.com/42IonicaBizau/git-url-parse"
12+
, gitSsh: "git+ssh://custom-user@github.com/42IonicaBizau/git-url-parse"
1313
, ref: "https://github.com/42IonicaBizau/git-url-parse/blob/master/test/index.js"
1414
, shorthand: "42IonicaBizau/git-url-parse"
1515
, commit: "https://github.com/42IonicaBizau/git-url-parse/commit/9c6443245ace92d237b7b274d4606a616e071c4e"
1616
};
1717

18+
const gitUser = (url) => url.replace('custom-user@', 'git@');
19+
1820
tester.describe("parse urls", test => {
1921

2022
// SSH urls
@@ -45,8 +47,8 @@ tester.describe("parse urls", test => {
4547
test.expect(res.name).toBe("git-url-parse");
4648
test.expect(res.href).toBe(URLS.ftp);
4749
test.expect(res.toString("https")).toBe(URLS.https);
48-
test.expect(res.toString("git+ssh")).toBe(URLS.gitSsh);
49-
test.expect(res.toString("ssh")).toBe(URLS.ssh);
50+
test.expect(res.toString("git+ssh")).toBe(gitUser(URLS.gitSsh));
51+
test.expect(res.toString("ssh")).toBe(gitUser(URLS.ssh));
5052
});
5153

5254
// FTPS urls
@@ -58,8 +60,8 @@ tester.describe("parse urls", test => {
5860
test.expect(res.name).toBe("git-url-parse");
5961
test.expect(res.href).toBe(URLS.ftps);
6062
test.expect(res.toString("https")).toBe(URLS.https);
61-
test.expect(res.toString("git+ssh")).toBe(URLS.gitSsh);
62-
test.expect(res.toString("ssh")).toBe(URLS.ssh);
63+
test.expect(res.toString("git+ssh")).toBe(gitUser(URLS.gitSsh));
64+
test.expect(res.toString("ssh")).toBe(gitUser(URLS.ssh));
6365
});
6466

6567
// HTTPS urls
@@ -71,8 +73,8 @@ tester.describe("parse urls", test => {
7173
test.expect(res.name).toBe("git-url-parse");
7274
test.expect(res.href).toBe(URLS.https);
7375
test.expect(res.toString("https")).toBe(URLS.https);
74-
test.expect(res.toString("git+ssh")).toBe(URLS.gitSsh);
75-
test.expect(res.toString("ssh")).toBe(URLS.ssh);
76+
test.expect(res.toString("git+ssh")).toBe(gitUser(URLS.gitSsh));
77+
test.expect(res.toString("ssh")).toBe(gitUser(URLS.ssh));
7678
});
7779

7880
// HTTPS with ending slash
@@ -83,8 +85,8 @@ tester.describe("parse urls", test => {
8385
test.expect(res.owner).toBe("42IonicaBizau");
8486
test.expect(res.name).toBe("git-url-parse");
8587
test.expect(res.toString("https")).toBe(URLS.https);
86-
test.expect(res.toString("git+ssh")).toBe(URLS.gitSsh);
87-
test.expect(res.toString("ssh")).toBe(URLS.ssh);
88+
test.expect(res.toString("git+ssh")).toBe(gitUser(URLS.gitSsh));
89+
test.expect(res.toString("ssh")).toBe(gitUser(URLS.ssh));
8890
});
8991

9092
// git+ssh protocol

0 commit comments

Comments
 (0)