

























@@ -63,16 +63,23 @@ describe("runtime-model-auth.runtime", () => {
6363baseUrl: "https://api.individual.githubcopilot.com",
6464expiresAt: 123,
6565});
66-expect(hoisted.prepareProviderRuntimeAuth).toHaveBeenCalledWith(
67-expect.objectContaining({
66+expect(hoisted.prepareProviderRuntimeAuth).toHaveBeenCalledWith({
67+provider: "github-copilot",
68+config: undefined,
69+workspaceDir: undefined,
70+env: process.env,
71+context: {
72+config: undefined,
73+workspaceDir: undefined,
74+env: process.env,
6875provider: "github-copilot",
69-context: expect.objectContaining({
70- apiKey: "github-device-token",
71- modelId: "github-copilot/gpt-4o",
72- provider: "github-copilot",
73-}),
74-}),
75-);
76+modelId: "github-copilot/gpt-4o",
77+model: MODEL,
78+apiKey: "github-device-token",
79+authMode: "token",
80+profileId: "github-copilot:github",
81+},
82+});
7683});
77847885it("falls back to raw auth when the provider has no runtime auth hook", async () => {
@@ -131,11 +138,15 @@ describe("runtime-model-auth.runtime", () => {
131138mode: "api-key",
132139});
133140134-await expect(getApiKeyForModel({ model: MODEL as never })).resolves.toMatchObject({
141+await expect(getApiKeyForModel({ model: MODEL as never })).resolves.toEqual({
135142apiKey: "model-key",
143+source: "env:OPENAI_API_KEY",
144+mode: "api-key",
136145});
137-await expect(resolveApiKeyForProvider({ provider: "openai" })).resolves.toMatchObject({
146+await expect(resolveApiKeyForProvider({ provider: "openai" })).resolves.toEqual({
138147apiKey: "provider-key",
148+source: "env:OPENAI_API_KEY",
149+mode: "api-key",
139150});
140151});
141152});
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。