fix: satisfy xai oauth lint · openclaw/openclaw@6208f2b
steipete
·
2026-05-16
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
|
1 | 1 | import { describe, expect, it, vi } from "vitest"; |
2 | 2 | import { |
3 | | -type OAuthCredential, |
4 | 3 | buildXaiOAuthAuthorizeUrl, |
5 | 4 | fetchXaiOAuthDiscovery, |
6 | 5 | isTrustedXaiOAuthEndpoint, |
@@ -80,7 +79,8 @@ describe("xAI OAuth", () => {
|
80 | 79 | it("refreshes with the cached token endpoint and preserves refresh fallback", async () => { |
81 | 80 | const fetchImpl = vi.fn(async (_url: string | URL | Request, init?: RequestInit) => { |
82 | 81 | expect(init?.method).toBe("POST"); |
83 | | -const body = String(init?.body); |
| 82 | +expect(typeof init?.body).toBe("string"); |
| 83 | +const body = init?.body as string; |
84 | 84 | expect(body).toContain("grant_type=refresh_token"); |
85 | 85 | expect(body).toContain(`client_id=${encodeURIComponent(XAI_OAUTH_CLIENT_ID)}`); |
86 | 86 | expect(body).toContain("refresh_token=refresh-1"); |
@@ -98,7 +98,7 @@ describe("xAI OAuth", () => {
|
98 | 98 | refresh: "refresh-1", |
99 | 99 | expires: 100, |
100 | 100 | tokenEndpoint: "https://auth.x.ai/oauth2/token", |
101 | | -} as OAuthCredential & { tokenEndpoint: string }, |
| 101 | +} as unknown as Parameters<typeof refreshXaiOAuthCredential>[0], |
102 | 102 | { fetchImpl, now: () => 1_000 }, |
103 | 103 | ); |
104 | 104 | |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。