Rename Factory to Foundry

This commit is contained in:
Nathan Flurry 2026-03-10 22:01:39 -07:00
parent 0a8fda040b
commit 324de36577
256 changed files with 605 additions and 603 deletions

View file

@ -0,0 +1,44 @@
import { describe, expect, test } from "vitest";
import { normalizeRemoteUrl, repoIdFromRemote } from "../src/services/repo.js";
describe("normalizeRemoteUrl", () => {
test("accepts GitHub shorthand owner/repo", () => {
expect(normalizeRemoteUrl("rivet-dev/sandbox-agent-foundry")).toBe(
"https://github.com/rivet-dev/sandbox-agent-foundry.git"
);
});
test("accepts github.com/owner/repo without scheme", () => {
expect(normalizeRemoteUrl("github.com/rivet-dev/sandbox-agent-foundry")).toBe(
"https://github.com/rivet-dev/sandbox-agent-foundry.git"
);
});
test("canonicalizes GitHub repo URLs without .git", () => {
expect(normalizeRemoteUrl("https://github.com/rivet-dev/sandbox-agent-foundry")).toBe(
"https://github.com/rivet-dev/sandbox-agent-foundry.git"
);
});
test("canonicalizes GitHub non-clone URLs (e.g. /tree/main)", () => {
expect(normalizeRemoteUrl("https://github.com/rivet-dev/sandbox-agent-foundry/tree/main")).toBe(
"https://github.com/rivet-dev/sandbox-agent-foundry.git"
);
});
test("does not rewrite scp-style ssh remotes", () => {
expect(normalizeRemoteUrl("git@github.com:rivet-dev/sandbox-agent-foundry.git")).toBe(
"git@github.com:rivet-dev/sandbox-agent-foundry.git"
);
});
});
describe("repoIdFromRemote", () => {
test("repoId is stable across equivalent GitHub inputs", () => {
const a = repoIdFromRemote("rivet-dev/sandbox-agent-foundry");
const b = repoIdFromRemote("https://github.com/rivet-dev/sandbox-agent-foundry.git");
const c = repoIdFromRemote("https://github.com/rivet-dev/sandbox-agent-foundry/tree/main");
expect(a).toBe(b);
expect(b).toBe(c);
});
});