mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-24 16:32:29 +00:00
fix(ci): repair voice-call typing and provider contracts
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import type { CallManagerContext } from "./context.js";
|
||||
|
||||
const {
|
||||
addTranscriptEntryMock,
|
||||
@@ -58,7 +59,10 @@ describe("voice-call outbound helpers", () => {
|
||||
});
|
||||
|
||||
it("guards initiateCall when provider, webhook, capacity, or fromNumber are missing", async () => {
|
||||
const base = {
|
||||
const base: Pick<
|
||||
CallManagerContext,
|
||||
"activeCalls" | "providerCallIdMap" | "config" | "storePath" | "webhookUrl"
|
||||
> = {
|
||||
activeCalls: new Map(),
|
||||
providerCallIdMap: new Map(),
|
||||
config: {
|
||||
@@ -70,7 +74,7 @@ describe("voice-call outbound helpers", () => {
|
||||
};
|
||||
|
||||
await expect(
|
||||
initiateCall({ ...(base as never), provider: undefined }, "+14155550123"),
|
||||
initiateCall({ ...base, provider: undefined } as never, "+14155550123"),
|
||||
).resolves.toEqual({
|
||||
callId: "",
|
||||
success: false,
|
||||
@@ -79,7 +83,7 @@ describe("voice-call outbound helpers", () => {
|
||||
|
||||
await expect(
|
||||
initiateCall(
|
||||
{ ...(base as never), provider: { name: "twilio" }, webhookUrl: undefined },
|
||||
{ ...base, provider: { name: "twilio" }, webhookUrl: undefined } as never,
|
||||
"+14155550123",
|
||||
),
|
||||
).resolves.toEqual({
|
||||
@@ -102,10 +106,10 @@ describe("voice-call outbound helpers", () => {
|
||||
await expect(
|
||||
initiateCall(
|
||||
{
|
||||
...(base as never),
|
||||
...base,
|
||||
provider: { name: "twilio" },
|
||||
config: { ...base.config, fromNumber: "" },
|
||||
},
|
||||
} as never,
|
||||
"+14155550123",
|
||||
),
|
||||
).resolves.toEqual({
|
||||
|
||||
@@ -38,7 +38,7 @@ import xiaomiPlugin from "../../../extensions/xiaomi/index.js";
|
||||
import zaiPlugin from "../../../extensions/zai/index.js";
|
||||
import { bundledWebSearchPluginRegistrations } from "../../bundled-web-search-registry.js";
|
||||
import { createCapturedPluginRegistration } from "../captured-registration.js";
|
||||
import { resolvePluginProviders } from "../providers.js";
|
||||
import { resolvePluginProviders } from "../provider-auth-choice.runtime.js";
|
||||
import type {
|
||||
ImageGenerationProviderPlugin,
|
||||
MediaUnderstandingProviderPlugin,
|
||||
@@ -139,10 +139,10 @@ function loadBundledProviderRegistry(): ProviderContractEntry[] {
|
||||
cache: false,
|
||||
activate: false,
|
||||
})
|
||||
.filter((provider): provider is ProviderPlugin & { pluginId: string } =>
|
||||
.filter((provider: ProviderPlugin): provider is ProviderPlugin & { pluginId: string } =>
|
||||
Boolean(provider.pluginId),
|
||||
)
|
||||
.map((provider) => ({
|
||||
.map((provider: ProviderPlugin & { pluginId: string }) => ({
|
||||
pluginId: provider.pluginId,
|
||||
provider,
|
||||
}));
|
||||
|
||||
Reference in New Issue
Block a user