





























@@ -265,16 +265,16 @@ describe("line outbound sendPayload", () => {
265265 cfg,
266266});
267267268-expect(mocks.sendMessageLine).toHaveBeenCalledWith(
269-"line:user:3",
270-"",
271-expect.objectContaining({
272- verbose: false,
273- mediaUrl: "https://example.com/img.jpg",
274- accountId: "default",
275- cfg,
276-}),
277-);
268+expect(mocks.sendMessageLine).toHaveBeenCalledWith("line:user:3", "", {
269+verbose: false,
270+mediaUrl: "https://example.com/img.jpg",
271+mediaKind: undefined,
272+previewImageUrl: undefined,
273+durationMs: undefined,
274+trackingId: undefined,
275+accountId: "default",
276+cfg,
277+});
278278expect(mocks.pushTextMessageWithQuickReplies).toHaveBeenCalledWith(
279279"line:user:3",
280280"Hello",
@@ -487,76 +487,74 @@ describe("line outbound sendPayload", () => {
487487setLineRuntime(runtime);
488488const cfg = { channels: { line: {} } } as OpenClawConfig;
489489490-await expect(
491-verifyChannelMessageAdapterCapabilityProofs({
492-adapterName: "line",
493-adapter: linePlugin.message!,
494-proofs: {
495-text: async () => {
496-const result = await linePlugin.message?.send?.text?.({
497- cfg,
498-to: "line:user:U123",
499-text: "hello",
500-accountId: "primary",
501-});
502-expect(mocks.pushMessageLine).toHaveBeenCalledWith("line:user:U123", "hello", {
503-verbose: false,
504-accountId: "primary",
505- cfg,
506-});
507-expect(result?.receipt.platformMessageIds).toEqual(["m-text"]);
508-},
509-media: async () => {
510-const result = await linePlugin.message?.send?.media?.({
511- cfg,
512-to: "line:user:U123",
513-text: "image",
514-mediaUrl: "https://example.com/image.jpg",
515-accountId: "primary",
516-});
517-expect(mocks.sendMessageLine).toHaveBeenCalledWith("line:user:U123", "", {
518-verbose: false,
519-mediaUrl: "https://example.com/image.jpg",
520-accountId: "primary",
521- cfg,
522-});
523-expect(result?.receipt.platformMessageIds).toEqual(["m-media"]);
524-},
525-messageSendingHooks: () => {
526-expect(linePlugin.message?.send?.text).toBeTypeOf("function");
527-},
490+const proofResults = await verifyChannelMessageAdapterCapabilityProofs({
491+adapterName: "line",
492+adapter: linePlugin.message!,
493+proofs: {
494+text: async () => {
495+const result = await linePlugin.message?.send?.text?.({
496+ cfg,
497+to: "line:user:U123",
498+text: "hello",
499+accountId: "primary",
500+});
501+expect(mocks.pushMessageLine).toHaveBeenCalledWith("line:user:U123", "hello", {
502+verbose: false,
503+accountId: "primary",
504+ cfg,
505+});
506+expect(result?.receipt.platformMessageIds).toEqual(["m-text"]);
528507},
529-}),
530-).resolves.toEqual(
531-expect.arrayContaining([
532-{ capability: "text", status: "verified" },
533-{ capability: "media", status: "verified" },
534-{ capability: "messageSendingHooks", status: "verified" },
535-]),
508+media: async () => {
509+const result = await linePlugin.message?.send?.media?.({
510+ cfg,
511+to: "line:user:U123",
512+text: "image",
513+mediaUrl: "https://example.com/image.jpg",
514+accountId: "primary",
515+});
516+expect(mocks.sendMessageLine).toHaveBeenCalledWith("line:user:U123", "", {
517+verbose: false,
518+mediaUrl: "https://example.com/image.jpg",
519+accountId: "primary",
520+ cfg,
521+});
522+expect(result?.receipt.platformMessageIds).toEqual(["m-media"]);
523+},
524+messageSendingHooks: () => {
525+expect(linePlugin.message?.send?.text).toBeTypeOf("function");
526+},
527+},
528+});
529+530+expect(proofResults.find((result) => result.capability === "text")?.status).toBe("verified");
531+expect(proofResults.find((result) => result.capability === "media")?.status).toBe("verified");
532+expect(proofResults.find((result) => result.capability === "messageSendingHooks")?.status).toBe(
533+"verified",
536534);
537535});
538536539537it("declares receive ack policies for deferred LINE webhook acknowledgement", async () => {
540-await expect(
541-verifyChannelMessageReceiveAckPolicyAdapterProofs({
542-adapterName: "line",
543-adapter: linePlugin.message!,
544-proofs: {
545-after_receive_record: () => {
546-expect(linePlugin.message?.receive?.supportedAckPolicies).toContain(
547-"after_receive_record",
548-);
549-},
550-after_agent_dispatch: () => {
551-expect(linePlugin.message?.receive?.defaultAckPolicy).toBe("after_agent_dispatch");
552-},
538+const proofResults = await verifyChannelMessageReceiveAckPolicyAdapterProofs({
539+adapterName: "line",
540+adapter: linePlugin.message!,
541+proofs: {
542+after_receive_record: () => {
543+expect(linePlugin.message?.receive?.supportedAckPolicies).toContain(
544+"after_receive_record",
545+);
553546},
554-}),
555-).resolves.toEqual(
556-expect.arrayContaining([
557-{ policy: "after_receive_record", status: "verified" },
558-{ policy: "after_agent_dispatch", status: "verified" },
559-]),
547+after_agent_dispatch: () => {
548+expect(linePlugin.message?.receive?.defaultAckPolicy).toBe("after_agent_dispatch");
549+},
550+},
551+});
552+553+expect(proofResults.find((result) => result.policy === "after_receive_record")?.status).toBe(
554+"verified",
555+);
556+expect(proofResults.find((result) => result.policy === "after_agent_dispatch")?.status).toBe(
557+"verified",
560558);
561559});
562560});
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。