test: delimit command span formatting · openclaw/openclaw@6dbe3b1
shakkernerd
·
2026-05-13
·
via Recent Commits to openclaw:main
File tree
src/infra/command-explainer
| Original file line number | Diff line number | Diff line change |
|---|
@@ -66,7 +66,7 @@ describe("formatCommandSpans", () => {
|
66 | 66 | it("anchors command spans to executable tokens after env assignments", async () => { |
67 | 67 | const explanation = await explainShellCommand("FOO=1 python -c 'print(1)'"); |
68 | 68 | |
69 | | -expect(formatCommandSpans(explanation)).toContainEqual({ startIndex: 6, endIndex: 12 }); |
| 69 | +expect(formatCommandSpans(explanation)).toEqual([{ startIndex: 6, endIndex: 12 }]); |
70 | 70 | }); |
71 | 71 | |
72 | 72 | it("includes nested executable spans from shell wrapper payloads", async () => { |
@@ -77,9 +77,7 @@ describe("formatCommandSpans", () => {
|
77 | 77 | const commandTexts = formatCommandSpans(explanation).map((commandSpan) => |
78 | 78 | explanation.source.slice(commandSpan.startIndex, commandSpan.endIndex), |
79 | 79 | ); |
80 | | -expect(commandTexts).toContain("sh"); |
81 | | -expect(commandTexts).toContain("echo"); |
82 | | -expect(commandTexts).toContain("node"); |
| 80 | +expect(commandTexts).toEqual(["sh", "echo", "node"]); |
83 | 81 | }); |
84 | 82 | |
85 | 83 | it("omits command spans for unsupported shell wrapper languages", async () => { |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。