test: tighten directive tag assertions · openclaw/openclaw@974fdc6
steipete
·
2026-05-09
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -216,9 +216,10 @@ describe("stripInlineDirectiveTagsFromMessageForDisplay", () => {
|
216 | 216 | content: [{ type: "text", text: "hello [[reply_to_current]] world [[audio_as_voice]]" }], |
217 | 217 | }; |
218 | 218 | const result = stripInlineDirectiveTagsFromMessageForDisplay(input); |
219 | | -expect(result).toMatchObject({ |
220 | | -content: [{ type: "text", text: "hello world " }], |
221 | | -}); |
| 219 | +if (!result) { |
| 220 | +throw new Error("expected stripped message"); |
| 221 | +} |
| 222 | +expect(result.content).toEqual([{ type: "text", text: "hello world " }]); |
222 | 223 | }); |
223 | 224 | |
224 | 225 | test("preserves empty-string text when directives are entire content", () => { |
@@ -227,9 +228,10 @@ describe("stripInlineDirectiveTagsFromMessageForDisplay", () => {
|
227 | 228 | content: [{ type: "text", text: "[[reply_to_current]]" }], |
228 | 229 | }; |
229 | 230 | const result = stripInlineDirectiveTagsFromMessageForDisplay(input); |
230 | | -expect(result).toMatchObject({ |
231 | | -content: [{ type: "text", text: "" }], |
232 | | -}); |
| 231 | +if (!result) { |
| 232 | +throw new Error("expected stripped message"); |
| 233 | +} |
| 234 | +expect(result.content).toEqual([{ type: "text", text: "" }]); |
233 | 235 | }); |
234 | 236 | |
235 | 237 | test("returns original message when content is not an array", () => { |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。