fix(config): resolve native commands schemas
This commit is contained in:
@@ -109,41 +109,25 @@ describe("voice-call plugin", () => {
|
|||||||
|
|
||||||
it("tool get_status returns json payload", async () => {
|
it("tool get_status returns json payload", async () => {
|
||||||
const { tools } = setup({ provider: "mock" });
|
const { tools } = setup({ provider: "mock" });
|
||||||
type VoiceTool = {
|
const tool = tools[0] as {
|
||||||
execute: (
|
execute: (id: string, params: unknown) => Promise<unknown>;
|
||||||
id: string,
|
|
||||||
params: unknown,
|
|
||||||
) =>
|
|
||||||
| Promise<{ details: Record<string, unknown> }>
|
|
||||||
| {
|
|
||||||
details: Record<string, unknown>;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
const tool = tools[0] as VoiceTool;
|
const result = (await tool.execute("id", {
|
||||||
const result = await tool.execute("id", {
|
|
||||||
action: "get_status",
|
action: "get_status",
|
||||||
callId: "call-1",
|
callId: "call-1",
|
||||||
});
|
})) as { details: { found?: boolean } };
|
||||||
expect((result.details as { found?: boolean }).found).toBe(true);
|
expect(result.details.found).toBe(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("legacy tool status without sid returns error payload", async () => {
|
it("legacy tool status without sid returns error payload", async () => {
|
||||||
const { tools } = setup({ provider: "mock" });
|
const { tools } = setup({ provider: "mock" });
|
||||||
type VoiceTool = {
|
const tool = tools[0] as {
|
||||||
execute: (
|
execute: (id: string, params: unknown) => Promise<unknown>;
|
||||||
id: string,
|
|
||||||
params: unknown,
|
|
||||||
) =>
|
|
||||||
| Promise<{ details: Record<string, unknown> }>
|
|
||||||
| {
|
|
||||||
details: Record<string, unknown>;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
const tool = tools[0] as VoiceTool;
|
const result = (await tool.execute("id", { mode: "status" })) as {
|
||||||
const result = await tool.execute("id", { mode: "status" });
|
details: { error?: unknown };
|
||||||
expect(String((result.details as { error?: unknown }).error)).toContain(
|
};
|
||||||
"sid required",
|
expect(String(result.details.error)).toContain("sid required");
|
||||||
);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it("CLI start prints JSON", async () => {
|
it("CLI start prints JSON", async () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user