The best way to control Claude Code, Codex and more from any computer or phone
| 1 | import { assert, describe, it } from "@effect/vitest"; |
| 2 | |
| 3 | import * as GitCafeHosts from "./gitCafeHosts.ts"; |
| 4 | |
| 5 | describe("gitCafeHosts", () => { |
| 6 | it("knows exactly the production and staging hosts", () => { |
| 7 | assert.deepStrictEqual([...GitCafeHosts.GITCAFE_HOSTS], ["git.cafe", "staging.git.cafe"]); |
| 8 | assert.isTrue(GitCafeHosts.isGitCafeHost("Git.Cafe")); |
| 9 | assert.isTrue(GitCafeHosts.isGitCafeHost("staging.git.cafe")); |
| 10 | for (const host of ["cafe", "evil.git.cafe", "git.cafe.example.com", "github.com"]) { |
| 11 | assert.isFalse(GitCafeHosts.isGitCafeHost(host), host); |
| 12 | } |
| 13 | }); |
| 14 | |
| 15 | it.each([ |
| 16 | ["https://staging.git.cafe/team/project.git/", "staging.git.cafe"], |
| 17 | ["ssh@git.cafe:team/project.git", "git.cafe"], |
| 18 | ["ssh://git@git.cafe/team/project.git", "git.cafe"], |
| 19 | ["ssh://git.cafe/team/project.git", "git.cafe"], |
| 20 | ["ssh://git.cafe:2222/team/project.git", "git.cafe"], |
| 21 | ["git.cafe:team/project.git", "git.cafe"], |
| 22 | ])("reads the host and repository of %s", (url, host) => { |
| 23 | assert.deepStrictEqual(GitCafeHosts.parseGitCafeRemote(url), { |
| 24 | host, |
| 25 | repository: "team/project", |
| 26 | }); |
| 27 | }); |
| 28 | |
| 29 | it.each([ |
| 30 | "https://evil.git.cafe/team/project.git", |
| 31 | "https://git.cafe/team/nested/project.git", |
| 32 | "team/project", |
| 33 | ])("is not a GitCafe repository: %s", (url) => { |
| 34 | assert.isNull(GitCafeHosts.parseGitCafeRemote(url)); |
| 35 | }); |
| 36 | }); |