Skip to content

Commit 1d77170

Browse files
committed
fix(xai): use public plugin test runtime (#84005) (thanks @fuller-stack-dev)
1 parent 6ee60fc commit 1d77170

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

extensions/xai/xai-oauth.test.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
import type { ProviderAuthContext } from "openclaw/plugin-sdk/plugin-entry";
2+
import {
3+
createRuntimeEnv,
4+
createTestWizardPrompter,
5+
} from "openclaw/plugin-sdk/plugin-test-runtime";
26
import type { OAuthCredential } from "openclaw/plugin-sdk/provider-auth";
3-
import { createRuntimeEnv, createTestWizardPrompter } from "openclaw/plugin-sdk/testing";
47
import { afterEach, describe, expect, it, vi } from "vitest";
58
import {
69
buildXaiOAuthAuthorizationCodeTokenBody,
@@ -203,7 +206,8 @@ describe("xAI OAuth", () => {
203206
vi.stubGlobal("fetch", fetchImpl);
204207
const note = vi.fn(async () => {});
205208
const openUrl = vi.fn(async () => {});
206-
const runtime = createRuntimeEnv();
209+
const log = vi.fn();
210+
const runtime = { ...createRuntimeEnv(), log };
207211
const ctx: ProviderAuthContext = {
208212
config: {},
209213
isRemote: true,
@@ -224,7 +228,7 @@ describe("xAI OAuth", () => {
224228

225229
expect(openUrl).not.toHaveBeenCalled();
226230
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];
228232
expect(remoteLog).toContain("https://accounts.x.ai/oauth2/device");
229233
expect(remoteLog).not.toContain("ABCD-1234");
230234
const deviceRequest = fetchImpl.mock.calls[1]?.[1];

0 commit comments

Comments
 (0)