24 lines
855 B
TypeScript
24 lines
855 B
TypeScript
import { strict as assert } from "node:assert";
|
|
import { test } from "node:test";
|
|
|
|
import {
|
|
DEFAULT_AGENTRUN_REPO_URL,
|
|
GITEA_AGENTRUN_REPO_URL,
|
|
resolveAgentRunRepoUrl
|
|
} from "./code-agent-agentrun-profile.ts";
|
|
|
|
test("resolveAgentRunRepoUrl allows approved internal mirrors", () => {
|
|
assert.equal(resolveAgentRunRepoUrl({}), DEFAULT_AGENTRUN_REPO_URL);
|
|
assert.equal(
|
|
resolveAgentRunRepoUrl({ HWLAB_CODE_AGENT_AGENTRUN_REPO_URL: `${GITEA_AGENTRUN_REPO_URL}/?token=ignored#fragment` }),
|
|
GITEA_AGENTRUN_REPO_URL
|
|
);
|
|
});
|
|
|
|
test("resolveAgentRunRepoUrl rejects unapproved internal repo URLs", () => {
|
|
assert.throws(
|
|
() => resolveAgentRunRepoUrl({ HWLAB_CODE_AGENT_AGENTRUN_REPO_URL: "http://gitea-http.devops-infra.svc.cluster.local:3000/other/HWLAB.git" }),
|
|
(error) => error?.code === "agentrun_internal_repo_url_required"
|
|
);
|
|
});
|