test: remove discord model picker polling loop · openclaw/openclaw@d092bf0
steipete
·
2026-05-12
·
via Recent Commits to openclaw:main
File tree
extensions/discord/src/monitor
| Original file line number | Diff line number | Diff line change |
|---|
@@ -56,21 +56,6 @@ function createModelsProviderData(entries: Record<string, string[]>): ModelsProv
|
56 | 56 | return createBaseModelsProviderData(entries, { defaultProviderOrder: "sorted" }); |
57 | 57 | } |
58 | 58 | |
59 | | -async function waitForCondition( |
60 | | -predicate: () => boolean, |
61 | | -opts?: { attempts?: number; delayMs?: number }, |
62 | | -): Promise<void> { |
63 | | -const attempts = opts?.attempts ?? 50; |
64 | | -const delayMs = opts?.delayMs ?? 0; |
65 | | -for (let index = 0; index < attempts; index += 1) { |
66 | | -if (predicate()) { |
67 | | -return; |
68 | | -} |
69 | | -await new Promise((resolve) => setTimeout(resolve, delayMs)); |
70 | | -} |
71 | | -throw new Error("condition not met"); |
72 | | -} |
73 | | - |
74 | 59 | function createModelPickerContext(): ModelPickerContext { |
75 | 60 | const cfg = { |
76 | 61 | session: { |
@@ -541,7 +526,7 @@ describe("Discord model picker interactions", () => {
|
541 | 526 | await button.run(submitInteraction as unknown as PickerButtonInteraction, submitData); |
542 | 527 | |
543 | 528 | expect(withTimeoutSpy).toHaveBeenCalledTimes(1); |
544 | | -await waitForCondition(() => dispatchSpy.mock.calls.length === 1); |
| 529 | +await vi.waitFor(() => expect(dispatchSpy).toHaveBeenCalledTimes(1)); |
545 | 530 | expect(submitInteraction.followUp).toHaveBeenCalledTimes(1); |
546 | 531 | const followUpPayload = submitInteraction.followUp.mock.calls[0]?.[0] as { |
547 | 532 | components?: Array<{ components?: Array<{ content?: string }> }>; |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。