chore: generate

This commit is contained in:
opencode-agent[bot]
2026-08-05 02:20:04 +00:00
parent cb88db6ce3
commit 5b4fb1f770
+4 -12
View File
@@ -1,10 +1,5 @@
import { describe, expect, test } from "bun:test" import { describe, expect, test } from "bun:test"
import { import { accessTokenIsExpiring, pollDeviceCodeToken, requestDeviceCode, XaiAuthPlugin } from "../../src/plugin/xai"
accessTokenIsExpiring,
pollDeviceCodeToken,
requestDeviceCode,
XaiAuthPlugin,
} from "../../src/plugin/xai"
import { OAUTH_DUMMY_KEY } from "../../src/auth" import { OAUTH_DUMMY_KEY } from "../../src/auth"
function makeJwt(payload: object): string { function makeJwt(payload: object): string {
@@ -397,8 +392,7 @@ describe("plugin.xai", () => {
}) })
const hooks = await XaiAuthPlugin({} as any, serverOptions(server)) const hooks = await XaiAuthPlugin({} as any, serverOptions(server))
const headless = hooks.auth!.methods.find( const headless = hooks.auth!.methods.find(
(m): m is Extract<typeof m, { type: "oauth" }> => (m): m is Extract<typeof m, { type: "oauth" }> => m.type === "oauth" && m.label === "SuperGrok Subscription",
m.type === "oauth" && m.label === "SuperGrok Subscription",
)! )!
const result = await headless.authorize!() const result = await headless.authorize!()
@@ -421,8 +415,7 @@ describe("plugin.xai", () => {
return new Response("unexpected request", { status: 500 }) return new Response("unexpected request", { status: 500 })
}) })
const headless = (await XaiAuthPlugin({} as any, serverOptions(server))).auth!.methods.find( const headless = (await XaiAuthPlugin({} as any, serverOptions(server))).auth!.methods.find(
(m): m is Extract<typeof m, { type: "oauth" }> => (m): m is Extract<typeof m, { type: "oauth" }> => m.type === "oauth" && m.label === "SuperGrok Subscription",
m.type === "oauth" && m.label === "SuperGrok Subscription",
)! )!
expect((await headless.authorize!()).url).toBe("https://x.ai/device") expect((await headless.authorize!()).url).toBe("https://x.ai/device")
}) })
@@ -584,8 +577,7 @@ describe("plugin.xai", () => {
return Response.json({ error: "access_denied" }, { status: 400 }) return Response.json({ error: "access_denied" }, { status: 400 })
}) })
const headless = (await XaiAuthPlugin({} as any, serverOptions(server))).auth!.methods.find( const headless = (await XaiAuthPlugin({} as any, serverOptions(server))).auth!.methods.find(
(m): m is Extract<typeof m, { type: "oauth" }> => (m): m is Extract<typeof m, { type: "oauth" }> => m.type === "oauth" && m.label === "SuperGrok Subscription",
m.type === "oauth" && m.label === "SuperGrok Subscription",
)! )!
expect(await ((await headless.authorize!()) as any).callback()).toEqual({ type: "failed" }) expect(await ((await headless.authorize!()) as any).callback()).toEqual({ type: "failed" })
}) })