chore: Fix more extension test type 1/N.

This commit is contained in:
cpojer
2026-02-17 10:12:14 +09:00
parent 0f8d1f175a
commit 72f00df95a
9 changed files with 75 additions and 26 deletions

View File

@@ -1,3 +1,4 @@
import type { OpenClawConfig } from "openclaw/plugin-sdk";
import { describe, it, expect, vi, beforeEach } from "vitest";
import { whatsappPlugin } from "./channel.js";
@@ -25,7 +26,8 @@ describe("whatsappPlugin.outbound.sendText", () => {
});
it("passes linkPreview option to sendMessageWhatsApp", async () => {
await whatsappPlugin.outbound.sendText({
await whatsappPlugin.outbound!.sendText!({
cfg: {} as OpenClawConfig,
to: "1234567890",
text: "http://example.com",
// @ts-expect-error - injecting extra param as per runtime behavior
@@ -42,7 +44,8 @@ describe("whatsappPlugin.outbound.sendText", () => {
});
it("passes linkPreview=undefined when omitted", async () => {
await whatsappPlugin.outbound.sendText({
await whatsappPlugin.outbound!.sendText!({
cfg: {} as OpenClawConfig,
to: "1234567890",
text: "hello",
});

View File

@@ -101,6 +101,9 @@ describe("whatsapp resolveTarget", () => {
});
expect(result.ok).toBe(true);
if (!result.ok) {
throw result.error;
}
expect(result.to).toBe("5511999999999@s.whatsapp.net");
});
@@ -112,6 +115,9 @@ describe("whatsapp resolveTarget", () => {
});
expect(result.ok).toBe(true);
if (!result.ok) {
throw result.error;
}
expect(result.to).toBe("5511999999999@s.whatsapp.net");
});
@@ -123,6 +129,9 @@ describe("whatsapp resolveTarget", () => {
});
expect(result.ok).toBe(true);
if (!result.ok) {
throw result.error;
}
expect(result.to).toBe("5511999999999@s.whatsapp.net");
});
@@ -134,6 +143,9 @@ describe("whatsapp resolveTarget", () => {
});
expect(result.ok).toBe(true);
if (!result.ok) {
throw result.error;
}
expect(result.to).toBe("120363123456789@g.us");
});
@@ -145,6 +157,9 @@ describe("whatsapp resolveTarget", () => {
});
expect(result.ok).toBe(false);
if (result.ok) {
throw new Error("expected resolution to fail");
}
expect(result.error).toBeDefined();
});