mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-19 12:28:37 +00:00
chore: Fix more extension test type 1/N.
This commit is contained in:
@@ -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",
|
||||
});
|
||||
|
||||
@@ -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();
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user