Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

sourceControl.test.ts

33 lines997 Bytes

1import { describe, expect, it } from "vite-plus/test";
2​
3import { isSshRemoteUrl } from "./sourceControl.ts";
4​
5describe("isSshRemoteUrl", () => {
6 it.each([
7 "git@github.com:owner/repo.git",
8 "alice+ci@github.com:owner/repo.git",
9 "ssh://git@github.com/owner/repo.git",
10 "github.com:owner/repo.git",
11 "github-work:owner/repo.git",
12 "gitserver:repo.git",
13 "ssh.dev.azure.com:v3/Org/My Project/My Repo",
14 ])("reads %s as SSH", (remoteUrl) => {
15 expect(isSshRemoteUrl(remoteUrl)).toBe(true);
16 });
17​
18 it.each([
19 "https://github.com/owner/repo.git",
20 "C:/repos/repo",
21 "/srv/git/repo.git",
22 "./team:group/repo",
23 "file:///srv/git/repo.git",
24 "hg::owner/repo",
25 "C:repo.git",
26 "ssh.dev.azure.com :v3/Org/MyProject/MyRepo",
27 "-oProxyCommand=x@github.com:owner/repo.git",
28 "@github.com:owner/repo.git",
29 ".\\dir@github.com:owner/repo",
30 ])("does not read %s as SSH", (remoteUrl) => {
31 expect(isSshRemoteUrl(remoteUrl)).toBe(false);
32 });
33});