






















@@ -117,6 +117,19 @@ vi.mock("../tts/tts.js", () => ({
117117textToSpeech: mocks.textToSpeech,
118118}));
119119120+function getTextToSpeechParams() {
121+const calls = (mocks.textToSpeech as unknown as { mock: { calls: unknown[][] } }).mock.calls;
122+return calls[0]?.[0] as
123+| {
124+text?: string;
125+cfg?: OpenClawConfig;
126+agentId?: string;
127+channel?: string;
128+accountId?: string;
129+}
130+| undefined;
131+}
132+120133describe("createOpenClawTools TTS config wiring", () => {
121134beforeEach(() => {
122135mocks.createCronToolOptions.mockClear();
@@ -153,12 +166,9 @@ describe("createOpenClawTools TTS config wiring", () => {
153166154167await tool.execute("call-1", { text: "hello from config" });
155168156-expect(mocks.textToSpeech).toHaveBeenCalledWith(
157-expect.objectContaining({
158-text: "hello from config",
159-cfg: injectedConfig,
160-}),
161-);
169+const ttsParams = getTextToSpeechParams();
170+expect(ttsParams?.text).toBe("hello from config");
171+expect(ttsParams?.cfg).toBe(injectedConfig);
162172} finally {
163173__testing.setDepsForTest();
164174}
@@ -208,12 +218,9 @@ describe("createOpenClawTools TTS config wiring", () => {
208218209219await tool.execute("call-1", { text: "hello from reader" });
210220211-expect(mocks.textToSpeech).toHaveBeenCalledWith(
212-expect.objectContaining({
213-text: "hello from reader",
214-agentId: "reader",
215-}),
216-);
221+const ttsParams = getTextToSpeechParams();
222+expect(ttsParams?.text).toBe("hello from reader");
223+expect(ttsParams?.agentId).toBe("reader");
217224} finally {
218225__testing.setDepsForTest();
219226}
@@ -251,14 +258,11 @@ describe("createOpenClawTools TTS config wiring", () => {
251258252259await tool.execute("call-1", { text: "hello from account" });
253260254-expect(mocks.textToSpeech).toHaveBeenCalledWith(
255-expect.objectContaining({
256-text: "hello from account",
257-cfg: injectedConfig,
258-channel: "feishu",
259-accountId: "feishu-main",
260-}),
261-);
261+const ttsParams = getTextToSpeechParams();
262+expect(ttsParams?.text).toBe("hello from account");
263+expect(ttsParams?.cfg).toBe(injectedConfig);
264+expect(ttsParams?.channel).toBe("feishu");
265+expect(ttsParams?.accountId).toBe("feishu-main");
262266} finally {
263267__testing.setDepsForTest();
264268}
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。