Files
Peter Steinberger cd0fb355c7 refactor(plugin-sdk): remove retired Copilot login chain (#122988)
* 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
2026-08-12 22:07:33 -07:00

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",
);
});
});