
























@@ -149,6 +149,7 @@ describe("voice-call plugin", () => {
149149150150afterEach(() => {
151151vi.restoreAllMocks();
152+vi.unstubAllEnvs();
152153delete (globalThis as Record<PropertyKey, unknown>)[Symbol.for("openclaw.voice-call.runtime")];
153154delete (globalThis as Record<PropertyKey, unknown>)[
154155Symbol.for("openclaw.voice-call.runtimePromise")
@@ -197,6 +198,50 @@ describe("voice-call plugin", () => {
197198expect(respond).toHaveBeenCalledWith(true, { callId: "call-2", initiated: true });
198199});
199200201+it("does not log a startup error when provider setup is incomplete", async () => {
202+vi.stubEnv("TWILIO_ACCOUNT_SID", "");
203+vi.stubEnv("TWILIO_AUTH_TOKEN", "");
204+vi.stubEnv("TWILIO_FROM_NUMBER", "");
205+const { service } = setup({ provider: "twilio" });
206+207+await service?.start(createServiceContext());
208+209+expect(createVoiceCallRuntime).not.toHaveBeenCalled();
210+expect(
211+noopLogger.error.mock.calls.some(([message]) =>
212+String(message).includes("Failed to start runtime"),
213+),
214+).toBe(false);
215+expect(noopLogger.warn).toHaveBeenCalledWith(
216+expect.stringContaining("Runtime not started; setup incomplete"),
217+);
218+expect(noopLogger.warn).toHaveBeenCalledWith(expect.stringContaining("TWILIO_ACCOUNT_SID"));
219+});
220+221+it("still reports missing provider setup when a command needs the runtime", async () => {
222+vi.stubEnv("TWILIO_ACCOUNT_SID", "");
223+vi.stubEnv("TWILIO_AUTH_TOKEN", "");
224+vi.stubEnv("TWILIO_FROM_NUMBER", "");
225+const { methods } = setup({ provider: "twilio" });
226+const handler = methods.get("voicecall.initiate") as
227+| ((ctx: {
228+params: Record<string, unknown>;
229+respond: ReturnType<typeof vi.fn>;
230+}) => Promise<void>)
231+| undefined;
232+const respond = vi.fn();
233+234+await handler?.({ params: { message: "Hi", to: "+15550001234" }, respond });
235+236+expect(createVoiceCallRuntime).not.toHaveBeenCalled();
237+expect(respond).toHaveBeenCalledWith(
238+false,
239+expect.objectContaining({
240+error: expect.stringContaining("TWILIO_ACCOUNT_SID"),
241+}),
242+);
243+});
244+200245it("initiates a call via voicecall.initiate", async () => {
201246const { methods } = setup({ provider: "mock" });
202247const handler = methods.get("voicecall.initiate") as
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。