mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-13 06:03:39 -06:00
cd0fb355c7
* refactor(plugin-sdk): remove retired Copilot login chain * chore(plugin-sdk): refresh generated API baselines * build(github-copilot): remove unused prompt dependency * chore(plugin-sdk): reconcile API baselines after rebase
39 lines
1.3 KiB
TypeScript
39 lines
1.3 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { PUBLIC_GITHUB_COPILOT_DOMAIN, resolveGithubCopilotDomain } from "./domain.js";
|
|
|
|
describe("github-copilot domain resolution", () => {
|
|
const withDomain = (githubDomain: string) =>
|
|
({
|
|
models: { providers: { "github-copilot": { params: { githubDomain } } } },
|
|
}) as never;
|
|
|
|
it("defaults to the public github.com host", () => {
|
|
expect(PUBLIC_GITHUB_COPILOT_DOMAIN).toBe("github.com");
|
|
expect(resolveGithubCopilotDomain({ env: {} })).toBe("github.com");
|
|
});
|
|
|
|
it("resolves domain by precedence env > config > default", () => {
|
|
expect(resolveGithubCopilotDomain({ env: {}, config: withDomain("cfg.ghe.com") })).toBe(
|
|
"cfg.ghe.com",
|
|
);
|
|
expect(
|
|
resolveGithubCopilotDomain({
|
|
env: { COPILOT_GITHUB_DOMAIN: "env.ghe.com" },
|
|
config: withDomain("cfg.ghe.com"),
|
|
}),
|
|
).toBe("env.ghe.com");
|
|
});
|
|
|
|
it("fails closed to github.com for unsafe or non-tenant hosts", () => {
|
|
expect(resolveGithubCopilotDomain({ env: {}, config: withDomain("acme.ghe.co") })).toBe(
|
|
"github.com",
|
|
);
|
|
expect(resolveGithubCopilotDomain({ env: {}, config: withDomain("api.acme.ghe.com") })).toBe(
|
|
"github.com",
|
|
);
|
|
expect(resolveGithubCopilotDomain({ env: { COPILOT_GITHUB_DOMAIN: "evil.com" } })).toBe(
|
|
"github.com",
|
|
);
|
|
});
|
|
});
|