11import type { ProviderAuthContext } from "openclaw/plugin-sdk/plugin-entry" ;
2+ import {
3+ createRuntimeEnv ,
4+ createTestWizardPrompter ,
5+ } from "openclaw/plugin-sdk/plugin-test-runtime" ;
26import type { OAuthCredential } from "openclaw/plugin-sdk/provider-auth" ;
3- import { createRuntimeEnv , createTestWizardPrompter } from "openclaw/plugin-sdk/testing" ;
47import { afterEach , describe , expect , it , vi } from "vitest" ;
58import {
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