test: tighten channel send assertions · openclaw/openclaw@86a8401
shakkernerd
·
2026-05-11
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -67,35 +67,35 @@ describe("sendWebhookMessageDiscord activity", () => {
|
67 | 67 | threadId: "thread-1", |
68 | 68 | }); |
69 | 69 | |
70 | | -expect(result).toMatchObject({ |
| 70 | +expect(result).toEqual({ |
71 | 71 | messageId: "msg-1", |
72 | 72 | channelId: "thread-1", |
73 | | -}); |
74 | | -expect(result.receipt).toEqual({ |
75 | | -primaryPlatformMessageId: "msg-1", |
76 | | -platformMessageIds: ["msg-1"], |
77 | | -parts: [ |
78 | | -{ |
79 | | -platformMessageId: "msg-1", |
80 | | -kind: "text", |
81 | | -index: 0, |
82 | | -threadId: "thread-1", |
83 | | -raw: { |
| 73 | +receipt: { |
| 74 | +primaryPlatformMessageId: "msg-1", |
| 75 | +platformMessageIds: ["msg-1"], |
| 76 | +parts: [ |
| 77 | +{ |
| 78 | +platformMessageId: "msg-1", |
| 79 | +kind: "text", |
| 80 | +index: 0, |
| 81 | +threadId: "thread-1", |
| 82 | +raw: { |
| 83 | +channel: "discord", |
| 84 | +messageId: "msg-1", |
| 85 | +channelId: "thread-1", |
| 86 | +}, |
| 87 | +}, |
| 88 | +], |
| 89 | +threadId: "thread-1", |
| 90 | +sentAt: 1_700_000_000_000, |
| 91 | +raw: [ |
| 92 | +{ |
84 | 93 | channel: "discord", |
85 | 94 | messageId: "msg-1", |
86 | 95 | channelId: "thread-1", |
87 | 96 | }, |
88 | | -}, |
89 | | -], |
90 | | -threadId: "thread-1", |
91 | | -sentAt: 1_700_000_000_000, |
92 | | -raw: [ |
93 | | -{ |
94 | | -channel: "discord", |
95 | | -messageId: "msg-1", |
96 | | -channelId: "thread-1", |
97 | | -}, |
98 | | -], |
| 97 | +], |
| 98 | +}, |
99 | 99 | }); |
100 | 100 | expect(recordChannelActivityMock).toHaveBeenCalledWith({ |
101 | 101 | channel: "discord", |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -12,7 +12,9 @@ describe("voice receive recovery", () => {
|
12 | 12 | analyzeVoiceReceiveError( |
13 | 13 | new Error("Failed to decrypt: DecryptionFailed(UnencryptedWhenPassthroughDisabled)"), |
14 | 14 | ), |
15 | | -).toMatchObject({ |
| 15 | +).toEqual({ |
| 16 | +message: "Failed to decrypt: DecryptionFailed(UnencryptedWhenPassthroughDisabled)", |
| 17 | +isAbortLike: false, |
16 | 18 | shouldAttemptPassthrough: true, |
17 | 19 | countsAsDecryptFailure: true, |
18 | 20 | }); |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -104,20 +104,30 @@ describe("send", () => {
|
104 | 104 | |
105 | 105 | expect(result.ok).toBe(true); |
106 | 106 | expect(result.messageId).toBe("twitch-msg-123"); |
107 | | -expect(result.receipt).toMatchObject({ |
| 107 | +expect(typeof result.receipt.sentAt).toBe("number"); |
| 108 | +expect({ ...result.receipt, sentAt: 0 }).toEqual({ |
108 | 109 | primaryPlatformMessageId: "twitch-msg-123", |
109 | 110 | platformMessageIds: ["twitch-msg-123"], |
110 | 111 | parts: [ |
111 | 112 | { |
112 | 113 | platformMessageId: "twitch-msg-123", |
113 | 114 | kind: "text", |
| 115 | +index: 0, |
114 | 116 | raw: { |
115 | 117 | channel: "twitch", |
116 | 118 | conversationId: "testchannel", |
117 | 119 | messageId: "twitch-msg-123", |
118 | 120 | }, |
119 | 121 | }, |
120 | 122 | ], |
| 123 | +raw: [ |
| 124 | +{ |
| 125 | +channel: "twitch", |
| 126 | +conversationId: "testchannel", |
| 127 | +messageId: "twitch-msg-123", |
| 128 | +}, |
| 129 | +], |
| 130 | +sentAt: 0, |
121 | 131 | }); |
122 | 132 | }); |
123 | 133 | |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。