






























@@ -2,14 +2,15 @@ import * as fs from "node:fs";
22import * as os from "node:os";
33import * as path from "node:path";
44import { afterEach, describe, expect, it, vi } from "vitest";
5-import { resolveSTTConfig, transcribeAudio } from "./stt.js";
6576const fetchWithSsrFGuardMock = vi.hoisted(() => vi.fn());
8798vi.mock("openclaw/plugin-sdk/ssrf-runtime", () => ({
109fetchWithSsrFGuard: fetchWithSsrFGuardMock,
1110}));
121112+import { resolveSTTConfig, transcribeAudio } from "./stt.js";
13+1314describe("engine/utils/stt", () => {
1415afterEach(() => {
1516fetchWithSsrFGuardMock.mockReset();
@@ -102,8 +103,8 @@ describe("engine/utils/stt", () => {
102103expect(transcript).toBe("hello from audio");
103104expect(fetchWithSsrFGuardMock).toHaveBeenCalledWith(
104105expect.objectContaining({
105-auditContext: "qqbot-stt",
106106url: "https://api.example.test/v1/audio/transcriptions",
107+auditContext: "qqbot-stt",
107108init: expect.objectContaining({
108109method: "POST",
109110headers: { Authorization: "Bearer secret" },
@@ -112,21 +113,5 @@ describe("engine/utils/stt", () => {
112113}),
113114);
114115expect(release).toHaveBeenCalledTimes(1);
115-const [{ init }] = fetchWithSsrFGuardMock.mock.calls[0] as [
116-{
117-init: {
118-body: FormData;
119-headers: Record<string, string>;
120-method: string;
121-};
122-},
123-];
124-expect(init).toEqual(
125-expect.objectContaining({
126-method: "POST",
127-headers: { Authorization: "Bearer secret" },
128-body: expect.any(FormData),
129-}),
130-);
131116});
132117});
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。