





















@@ -163,13 +163,11 @@ describe("createWebOnMessageHandler audio preflight", () => {
163163await handler(makeAudioMsg());
164164165165expect(events).toEqual(["ack", "stt"]);
166-expect(processMessageMock).toHaveBeenCalledWith(
167-expect.objectContaining({
168-preflightAudioTranscript: "transcribed voice note",
169-ackAlreadySent: true,
170-ackReaction: ackReactionHandle,
171-}),
172-);
166+expect(processMessageMock).toHaveBeenCalledTimes(1);
167+const [processParams] = processMessageMock.mock.calls[0] ?? [];
168+expect(processParams.preflightAudioTranscript).toBe("transcribed voice note");
169+expect(processParams.ackAlreadySent).toBe(true);
170+expect(processParams.ackReaction).toBe(ackReactionHandle);
173171});
174172175173it("skips early DM ack/preflight when access-control was not explicitly passed through", async () => {
@@ -205,12 +203,11 @@ describe("createWebOnMessageHandler audio preflight", () => {
205203expect(events).toStrictEqual([]);
206204expect(transcribeFirstAudioMock).not.toHaveBeenCalled();
207205expect(maybeSendAckReactionMock).not.toHaveBeenCalled();
208-expect(processMessageMock).toHaveBeenCalledWith(
209-expect.not.objectContaining({
210-preflightAudioTranscript: expect.anything(),
211-ackAlreadySent: true,
212-}),
213-);
206+expect(processMessageMock).toHaveBeenCalledTimes(1);
207+const [processParams] = processMessageMock.mock.calls[0] ?? [];
208+expect(processParams).not.toHaveProperty("preflightAudioTranscript");
209+expect(processParams).not.toHaveProperty("ackAlreadySent");
210+expect(processParams).not.toHaveProperty("ackReaction");
214211});
215212216213it("preserves per-agent ack checks for group broadcast voice notes", async () => {
@@ -295,25 +292,19 @@ describe("createWebOnMessageHandler audio preflight", () => {
295292296293await handler(makeGroupAudioMsg());
297294298-expect(applyGroupGatingMock).toHaveBeenNthCalledWith(
299-1,
300-expect.objectContaining({
301-deferMissingMention: true,
302-}),
303-);
295+expect(applyGroupGatingMock).toHaveBeenCalledTimes(2);
296+const [firstGatingParams] = applyGroupGatingMock.mock.calls[0] ?? [];
297+expect(firstGatingParams.deferMissingMention).toBe(true);
298+expect(firstGatingParams).not.toHaveProperty("mentionText");
304299expect(events).toEqual(["ack", "stt"]);
305-expect(applyGroupGatingMock).toHaveBeenNthCalledWith(
306-2,
307-expect.objectContaining({
308-mentionText: "transcribed voice note",
309-}),
310-);
311-expect(processMessageMock).toHaveBeenCalledWith(
312-expect.objectContaining({
313-preflightAudioTranscript: "transcribed voice note",
314-ackAlreadySent: true,
315-}),
316-);
300+const [secondGatingParams] = applyGroupGatingMock.mock.calls[1] ?? [];
301+expect(secondGatingParams.mentionText).toBe("transcribed voice note");
302+expect(secondGatingParams).not.toHaveProperty("deferMissingMention");
303+expect(processMessageMock).toHaveBeenCalledTimes(1);
304+const [processParams] = processMessageMock.mock.calls[0] ?? [];
305+expect(processParams.preflightAudioTranscript).toBe("transcribed voice note");
306+expect(processParams.ackAlreadySent).toBe(true);
307+expect(processParams.ackReaction).toBe(ackReactionHandle);
317308});
318309319310it("passes routing ctx fields to transcribeFirstAudio so echoTranscript can deliver (#79778)", async () => {
@@ -351,10 +342,16 @@ describe("createWebOnMessageHandler audio preflight", () => {
351342352343await handler(makeAudioMsg());
353344354-expect(capturedCtx).toMatchObject({
345+expect(capturedCtx).toEqual({
346+MediaPaths: ["/tmp/voice.ogg"],
347+MediaTypes: ["audio/ogg; codecs=opus"],
348+From: "+15550000002",
349+To: "+15550000001",
355350Provider: "whatsapp",
351+Surface: "whatsapp",
352+OriginatingChannel: "whatsapp",
356353OriginatingTo: "+15550000002",
357-From: "+15550000002",
354+AccountId: "default",
358355});
359356});
360357此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。