mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-17 07:03:25 +00:00
Read GitHub Copilot token from oauth.json in test
This commit is contained in:
parent
5a59b8d18d
commit
f8550a536e
1 changed files with 14 additions and 4 deletions
|
|
@ -678,19 +678,29 @@ describe("Generate E2E Tests", () => {
|
|||
});
|
||||
});
|
||||
|
||||
describe.skipIf(!process.env.GITHUB_COPILOT_TOKEN)("GitHub Copilot Provider (gpt-4o via OpenAI Completions)", () => {
|
||||
// Read GitHub Copilot token from ~/.pi/agent/oauth.json if available
|
||||
let githubCopilotToken: string | undefined;
|
||||
try {
|
||||
const oauthPath = join(process.env.HOME || "", ".pi/agent/oauth.json");
|
||||
const oauthData = JSON.parse(readFileSync(oauthPath, "utf-8"));
|
||||
githubCopilotToken = oauthData["github-copilot"]?.access;
|
||||
} catch {
|
||||
// oauth.json doesn't exist or is invalid
|
||||
}
|
||||
|
||||
describe.skipIf(!githubCopilotToken)("GitHub Copilot Provider (gpt-4o via OpenAI Completions)", () => {
|
||||
const llm = getModel("github-copilot", "gpt-4o");
|
||||
|
||||
it("should complete basic text generation", async () => {
|
||||
await basicTextGeneration(llm, { apiKey: process.env.GITHUB_COPILOT_TOKEN });
|
||||
await basicTextGeneration(llm, { apiKey: githubCopilotToken });
|
||||
});
|
||||
|
||||
it("should handle tool calling", async () => {
|
||||
await handleToolCall(llm, { apiKey: process.env.GITHUB_COPILOT_TOKEN });
|
||||
await handleToolCall(llm, { apiKey: githubCopilotToken });
|
||||
});
|
||||
|
||||
it("should handle streaming", async () => {
|
||||
await handleStreaming(llm, { apiKey: process.env.GITHUB_COPILOT_TOKEN });
|
||||
await handleStreaming(llm, { apiKey: githubCopilotToken });
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue