test(agents): dedupe copilot models-config token setup

This commit is contained in:
Peter Steinberger
2026-02-19 09:03:32 +00:00
parent b4dbe03298
commit 0900ec38a9
3 changed files with 21 additions and 44 deletions

View File

@@ -71,6 +71,17 @@ export function mockCopilotTokenExchangeSuccess(): MockFn {
return fetchMock;
}
export async function withCopilotGithubToken<T>(
token: string,
fn: (fetchMock: MockFn) => Promise<T>,
): Promise<T> {
return withTempEnv(["COPILOT_GITHUB_TOKEN"], async () => {
process.env.COPILOT_GITHUB_TOKEN = token;
const fetchMock = mockCopilotTokenExchangeSuccess();
return fn(fetchMock);
});
}
export const MODELS_CONFIG_IMPLICIT_ENV_VARS = [
"CLOUDFLARE_AI_GATEWAY_API_KEY",
"COPILOT_GITHUB_TOKEN",