test: clear remaining qqbot broad matchers

This commit is contained in:
Shakker
2026-05-10 16:34:44 +01:00
parent 1e7e750431
commit 4702d2bff5
3 changed files with 17 additions and 21 deletions

View File

@@ -242,8 +242,8 @@ describe("media-chunked: ChunkedMediaApi.uploadChunked", () => {
// 3 COS PUTs, one per part, each to the presigned URL.
expect(fetchSpy).toHaveBeenCalledTimes(3);
const putUrls = fetchSpy.mock.calls.map((c) => (c[0] as { url: string }).url);
expect(putUrls).toEqual(
expect.arrayContaining([
expect(new Set(putUrls)).toEqual(
new Set([
"https://cos.example.com/part-1",
"https://cos.example.com/part-2",
"https://cos.example.com/part-3",

View File

@@ -204,14 +204,13 @@ describe("dispatchOutbound", () => {
accountId: "qq-main",
});
expect(audioFileToSilkBase64Mock).toHaveBeenCalledWith("/tmp/openclaw-qqbot/tts.wav");
expect(sendMediaMock).toHaveBeenCalledWith(
expect.objectContaining({
kind: "voice",
source: { base64: "silk-base64" },
msgId: "msg-1",
ttsText: "read this aloud",
}),
);
const sentMedia = sendMediaMock.mock.calls[0]?.[0] as
| { kind?: string; source?: unknown; msgId?: string; ttsText?: string }
| undefined;
expect(sentMedia?.kind).toBe("voice");
expect(sentMedia?.source).toEqual({ base64: "silk-base64" });
expect(sentMedia?.msgId).toBe("msg-1");
expect(sentMedia?.ttsText).toBe("read this aloud");
expect(sendTextMock).not.toHaveBeenCalled();
});

View File

@@ -101,17 +101,14 @@ describe("engine/utils/stt", () => {
});
expect(transcript).toBe("hello from audio");
expect(fetchWithSsrFGuardMock).toHaveBeenCalledWith(
expect.objectContaining({
url: "https://api.example.test/v1/audio/transcriptions",
auditContext: "qqbot-stt",
init: expect.objectContaining({
method: "POST",
headers: { Authorization: "Bearer secret" },
body: expect.any(FormData),
}),
}),
);
const request = fetchWithSsrFGuardMock.mock.calls[0]?.[0] as
| { url?: string; auditContext?: string; init?: RequestInit }
| undefined;
expect(request?.url).toBe("https://api.example.test/v1/audio/transcriptions");
expect(request?.auditContext).toBe("qqbot-stt");
expect(request?.init?.method).toBe("POST");
expect(request?.init?.headers).toEqual({ Authorization: "Bearer secret" });
expect(request?.init?.body).toBeInstanceOf(FormData);
expect(release).toHaveBeenCalledTimes(1);
});
});