the universal sandbox runtime for agents and humans.
pocketenv.io
sandbox
openclaw
agent
claude-code
vercel-sandbox
deno-sandbox
cloudflare-sandbox
atproto
sprites
daytona
1import { describe, it, expect } from "vitest";
2import { expandRepo } from "./expandRepo.ts";
3
4describe("expandRepo", () => {
5 describe("github: shorthand", () => {
6 it("expands to a GitHub URL", () => {
7 expect(expandRepo("github:owner/repo")).toBe(
8 "https://github.com/owner/repo",
9 );
10 });
11
12 it("preserves the owner and repo name exactly", () => {
13 expect(expandRepo("github:my-org/my-repo-123")).toBe(
14 "https://github.com/my-org/my-repo-123",
15 );
16 });
17
18 it("does not expand if more than one slash after github:", () => {
19 expect(expandRepo("github:owner/repo/extra")).toBe(
20 "github:owner/repo/extra",
21 );
22 });
23
24 it("does not expand if no slash after github:", () => {
25 expect(expandRepo("github:owner")).toBe("github:owner");
26 });
27 });
28
29 describe("tangled: shorthand", () => {
30 it("expands to a Tangled URL", () => {
31 expect(expandRepo("tangled:owner/repo")).toBe(
32 "https://tangled.org/owner/repo",
33 );
34 });
35 });
36
37 describe("gitlab: shorthand", () => {
38 it("expands to a GitLab URL", () => {
39 expect(expandRepo("gitlab:owner/repo")).toBe(
40 "https://gitlab.com/owner/repo",
41 );
42 });
43 });
44
45 describe("passthrough (no shorthand)", () => {
46 it("returns a full HTTPS URL unchanged", () => {
47 expect(expandRepo("https://github.com/owner/repo")).toBe(
48 "https://github.com/owner/repo",
49 );
50 });
51
52 it("returns an SSH URL unchanged", () => {
53 expect(expandRepo("git@github.com:owner/repo.git")).toBe(
54 "git@github.com:owner/repo.git",
55 );
56 });
57
58 it("returns an arbitrary string unchanged", () => {
59 expect(expandRepo("notascheme")).toBe("notascheme");
60 });
61 });
62});