


























@@ -19,6 +19,13 @@ vi.mock("openclaw/plugin-sdk/channel-activity-runtime", async () => {
1919};
2020});
212122+function requireRecord(value: unknown, label: string): Record<string, unknown> {
23+if (typeof value !== "object" || value === null) {
24+throw new Error(`${label} was not an object`);
25+}
26+return value as Record<string, unknown>;
27+}
28+2229describe("createWebSendApi", () => {
2330const sendMessage = vi.fn(
2431async (
@@ -38,15 +45,6 @@ describe("createWebSendApi", () => {
3845});
3946});
404741-function requireRecord(value: unknown, label: string): Record<string, unknown> {
42-expect(typeof value).toBe("object");
43-expect(value).not.toBeNull();
44-if (typeof value !== "object" || value === null) {
45-throw new Error(`${label} was not an object`);
46-}
47-return value as Record<string, unknown>;
48-}
49-5048function expectRecordFields(record: Record<string, unknown>, fields: Record<string, unknown>) {
5149for (const [key, value] of Object.entries(fields)) {
5250expect(record[key]).toEqual(value);
@@ -423,9 +421,8 @@ describe("createWebSendApi LID resolution (issue #67378)", () => {
423421});
424422await api.sendPoll("+15555550000", { question: "Q?", options: ["a", "b"] });
425423expect(sendMessage.mock.calls[0]?.[0]).toBe("987654@lid");
426-expect(typeof sendMessage.mock.calls[0]?.[1]).toBe("object");
427-expect(sendMessage.mock.calls[0]?.[1]).not.toBeNull();
428-expect("poll" in (sendMessage.mock.calls[0]?.[1] as Record<string, unknown>)).toBe(true);
424+const payload = requireRecord(sendMessage.mock.calls[0]?.[1], "send poll payload");
425+expect("poll" in payload).toBe(true);
429426});
430427431428it("resolves PN to LID for sendComposingTo presence", async () => {
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。