test(xai): type device-code note mock · openclaw/openclaw@5e2c200
steipete
·
2026-05-30
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -389,7 +389,7 @@ describe("xAI OAuth", () => {
|
389 | 389 | }), |
390 | 390 | ); |
391 | 391 | vi.stubGlobal("fetch", fetchImpl); |
392 | | -const note = vi.fn(async () => {}); |
| 392 | +const note = vi.fn<(message: string, title?: string) => Promise<void>>(async () => {}); |
393 | 393 | const openUrl = vi.fn(async () => {}); |
394 | 394 | const log = vi.fn(); |
395 | 395 | const runtime = { ...createRuntimeEnv(), log }; |
@@ -478,7 +478,7 @@ describe("xAI OAuth", () => {
|
478 | 478 | }), |
479 | 479 | ); |
480 | 480 | vi.stubGlobal("fetch", fetchImpl); |
481 | | -const note = vi.fn(async () => {}); |
| 481 | +const note = vi.fn<(message: string, title?: string) => Promise<void>>(async () => {}); |
482 | 482 | const ctx: ProviderAuthContext = { |
483 | 483 | config: {}, |
484 | 484 | isRemote: true, |
@@ -497,7 +497,10 @@ describe("xAI OAuth", () => {
|
497 | 497 | |
498 | 498 | await loginXaiDeviceCode(ctx); |
499 | 499 | |
500 | | -expect(note.mock.calls[0]?.[0] ?? "").toContain("Code expires in 5 minutes."); |
| 500 | +expect(note).toHaveBeenCalledWith( |
| 501 | +expect.stringContaining("Code expires in 5 minutes."), |
| 502 | +"xAI device code", |
| 503 | +); |
501 | 504 | expect(progress.stop).toHaveBeenCalledWith("xAI device code complete"); |
502 | 505 | }); |
503 | 506 | }); |
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。