mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-24 08:21:39 +00:00
fix(ci): repair tts and matrix refactor fallout
This commit is contained in:
@@ -2,13 +2,13 @@ import { readFileSync } from "node:fs";
|
||||
import fs from "node:fs/promises";
|
||||
import {
|
||||
Category,
|
||||
MemoryStore,
|
||||
SyncAccumulator,
|
||||
type ISyncData,
|
||||
type IRooms,
|
||||
type ISyncResponse,
|
||||
type IStoredClientOpts,
|
||||
} from "matrix-js-sdk";
|
||||
import { MemoryStore } from "matrix-js-sdk/lib/store/memory.js";
|
||||
import { SyncAccumulator } from "matrix-js-sdk/lib/sync-accumulator.js";
|
||||
import { writeJsonFileAtomically } from "../../runtime-api.js";
|
||||
import { LogService } from "../sdk/logger.js";
|
||||
|
||||
|
||||
@@ -69,14 +69,19 @@ describe("voice-call outbound helpers", () => {
|
||||
webhookUrl: "https://example.com/webhook",
|
||||
};
|
||||
|
||||
await expect(initiateCall({ ...(base as never), provider: undefined }, "+14155550123")).resolves.toEqual({
|
||||
await expect(
|
||||
initiateCall({ ...(base as never), provider: undefined }, "+14155550123"),
|
||||
).resolves.toEqual({
|
||||
callId: "",
|
||||
success: false,
|
||||
error: "Provider not initialized",
|
||||
});
|
||||
|
||||
await expect(
|
||||
initiateCall({ ...(base as never), provider: { name: "twilio" }, webhookUrl: undefined }, "+14155550123"),
|
||||
initiateCall(
|
||||
{ ...(base as never), provider: { name: "twilio" }, webhookUrl: undefined },
|
||||
"+14155550123",
|
||||
),
|
||||
).resolves.toEqual({
|
||||
callId: "",
|
||||
success: false,
|
||||
@@ -95,7 +100,14 @@ describe("voice-call outbound helpers", () => {
|
||||
});
|
||||
|
||||
await expect(
|
||||
initiateCall({ ...(base as never), provider: { name: "twilio" }, config: { ...base.config, fromNumber: "" } }, "+14155550123"),
|
||||
initiateCall(
|
||||
{
|
||||
...(base as never),
|
||||
provider: { name: "twilio" },
|
||||
config: { ...base.config, fromNumber: "" },
|
||||
},
|
||||
"+14155550123",
|
||||
),
|
||||
).resolves.toEqual({
|
||||
callId: "",
|
||||
success: false,
|
||||
@@ -224,7 +236,11 @@ describe("voice-call outbound helpers", () => {
|
||||
}),
|
||||
);
|
||||
expect(clearMaxDurationTimerMock).toHaveBeenCalledWith(ctx, "call-1");
|
||||
expect(rejectTranscriptWaiterMock).toHaveBeenCalledWith(ctx, "call-1", "Call ended: hangup-bot");
|
||||
expect(rejectTranscriptWaiterMock).toHaveBeenCalledWith(
|
||||
ctx,
|
||||
"call-1",
|
||||
"Call ended: hangup-bot",
|
||||
);
|
||||
expect(ctx.activeCalls.size).toBe(0);
|
||||
expect(ctx.providerCallIdMap.size).toBe(0);
|
||||
});
|
||||
@@ -247,7 +263,9 @@ describe("voice-call outbound helpers", () => {
|
||||
await expect(
|
||||
endCall(
|
||||
{
|
||||
activeCalls: new Map([["call-1", { callId: "call-1", state: "completed", providerCallId: "provider-1" }]]),
|
||||
activeCalls: new Map([
|
||||
["call-1", { callId: "call-1", state: "completed", providerCallId: "provider-1" }],
|
||||
]),
|
||||
providerCallIdMap: new Map(),
|
||||
provider: { hangupCall: vi.fn() },
|
||||
storePath: "/tmp/voice-call.json",
|
||||
|
||||
@@ -56,7 +56,7 @@ describe("speech provider registry", () => {
|
||||
|
||||
const providers = listSpeechProviders();
|
||||
|
||||
expect(providers.map((provider) => provider.id)).toEqual(["openai"]);
|
||||
expect(providers.map((provider) => provider.id)).toEqual(["openai", "elevenlabs", "microsoft"]);
|
||||
expect(loadOpenClawPluginsMock).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
@@ -74,14 +74,22 @@ describe("speech provider registry", () => {
|
||||
|
||||
const cfg = {} as OpenClawConfig;
|
||||
|
||||
expect(listSpeechProviders(cfg).map((provider) => provider.id)).toEqual(["microsoft"]);
|
||||
expect(listSpeechProviders(cfg).map((provider) => provider.id)).toEqual([
|
||||
"openai",
|
||||
"elevenlabs",
|
||||
"microsoft",
|
||||
]);
|
||||
expect(getSpeechProvider("edge", cfg)?.id).toBe("microsoft");
|
||||
expect(loadOpenClawPluginsMock).toHaveBeenCalledWith({ config: cfg });
|
||||
});
|
||||
|
||||
it("returns no providers when neither plugins nor active registry provide speech support", () => {
|
||||
expect(listSpeechProviders()).toEqual([]);
|
||||
expect(getSpeechProvider("openai")).toBeUndefined();
|
||||
it("returns builtin providers when neither plugins nor active registry provide speech support", () => {
|
||||
expect(listSpeechProviders().map((provider) => provider.id)).toEqual([
|
||||
"openai",
|
||||
"elevenlabs",
|
||||
"microsoft",
|
||||
]);
|
||||
expect(getSpeechProvider("openai")?.id).toBe("openai");
|
||||
});
|
||||
|
||||
it("normalizes the legacy edge alias to microsoft", () => {
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
import { buildElevenLabsSpeechProvider } from "../../extensions/elevenlabs/speech-provider.js";
|
||||
import { buildMicrosoftSpeechProvider } from "../../extensions/microsoft/speech-provider.js";
|
||||
import { buildOpenAISpeechProvider } from "../../extensions/openai/speech-provider.js";
|
||||
import type { OpenClawConfig } from "../config/config.js";
|
||||
import {
|
||||
buildElevenLabsSpeechProvider,
|
||||
buildMicrosoftSpeechProvider,
|
||||
buildOpenAISpeechProvider,
|
||||
} from "../plugin-sdk/speech.js";
|
||||
import { loadOpenClawPlugins } from "../plugins/loader.js";
|
||||
import { getActivePluginRegistry } from "../plugins/runtime.js";
|
||||
import type { SpeechProviderPlugin } from "../plugins/types.js";
|
||||
|
||||
@@ -46,9 +46,8 @@ describe("scripts/test-extension.mjs", () => {
|
||||
const plan = resolveExtensionTestPlan({ targetArg: "line", cwd: process.cwd() });
|
||||
|
||||
expect(plan.roots).toContain("extensions/line");
|
||||
expect(plan.roots).toContain("src/line");
|
||||
expect(plan.config).toBe("vitest.channels.config.ts");
|
||||
expect(plan.testFiles.some((file) => file.startsWith("src/line/"))).toBe(true);
|
||||
expect(plan.config).toBe("vitest.extensions.config.ts");
|
||||
expect(plan.testFiles.some((file) => file.startsWith("extensions/line/"))).toBe(true);
|
||||
});
|
||||
|
||||
it("infers the extension from the current working directory", () => {
|
||||
|
||||
Reference in New Issue
Block a user