|
1 | 1 | import type { ProviderAuthContext } from "openclaw/plugin-sdk/plugin-entry"; |
| 2 | +import { |
| 3 | +createRuntimeEnv, |
| 4 | +createTestWizardPrompter, |
| 5 | +} from "openclaw/plugin-sdk/plugin-test-runtime"; |
2 | 6 | import type { OAuthCredential } from "openclaw/plugin-sdk/provider-auth"; |
3 | | -import { createRuntimeEnv, createTestWizardPrompter } from "openclaw/plugin-sdk/testing"; |
4 | 7 | import { afterEach, describe, expect, it, vi } from "vitest"; |
5 | 8 | import { |
6 | 9 | buildXaiOAuthAuthorizationCodeTokenBody, |
@@ -203,7 +206,8 @@ describe("xAI OAuth", () => {
|
203 | 206 | vi.stubGlobal("fetch", fetchImpl); |
204 | 207 | const note = vi.fn(async () => {}); |
205 | 208 | const openUrl = vi.fn(async () => {}); |
206 | | -const runtime = createRuntimeEnv(); |
| 209 | +const log = vi.fn(); |
| 210 | +const runtime = { ...createRuntimeEnv(), log }; |
207 | 211 | const ctx: ProviderAuthContext = { |
208 | 212 | config: {}, |
209 | 213 | isRemote: true, |
@@ -224,7 +228,7 @@ describe("xAI OAuth", () => {
|
224 | 228 | |
225 | 229 | expect(openUrl).not.toHaveBeenCalled(); |
226 | 230 | expect(note).toHaveBeenCalledWith(expect.stringContaining("ABCD-1234"), "xAI device code"); |
227 | | -const remoteLog = runtime.log.mock.calls[0]?.[0]; |
| 231 | +const remoteLog = log.mock.calls[0]?.[0]; |
228 | 232 | expect(remoteLog).toContain("https://accounts.x.ai/oauth2/device"); |
229 | 233 | expect(remoteLog).not.toContain("ABCD-1234"); |
230 | 234 | const deviceRequest = fetchImpl.mock.calls[1]?.[1]; |
|