test: present command output text · openclaw/openclaw@ed20e5e
shakkernerd
·
2026-05-13
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -47,11 +47,11 @@ function logMessages(): string[] {
|
47 | 47 | } |
48 | 48 | |
49 | 49 | function expectLogWith(text: string): void { |
50 | | -expect(logMessages().some((message) => message.includes(text))).toBe(true); |
| 50 | +expect(logMessages().join("\n")).toContain(text); |
51 | 51 | } |
52 | 52 | |
53 | 53 | function expectNoLogWith(text: string): void { |
54 | | -expect(logMessages().some((message) => message.includes(text))).toBe(false); |
| 54 | +expect(logMessages().join("\n")).not.toContain(text); |
55 | 55 | } |
56 | 56 | |
57 | 57 | function mockSnapshot(token: unknown = "abc") { |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -45,7 +45,7 @@ describe("sessionsCommand", () => {
|
45 | 45 | |
46 | 46 | fs.rmSync(store); |
47 | 47 | |
48 | | -expect(logs.some((line) => line.includes("Tokens (ctx %"))).toBe(true); |
| 48 | +expect(logs.join("\n")).toContain("Tokens (ctx %"); |
49 | 49 | |
50 | 50 | const row = logs.find((line) => line.includes("+15555550123")) ?? ""; |
51 | 51 | expect(row).toBe( |
@@ -82,7 +82,7 @@ describe("sessionsCommand", () => {
|
82 | 82 | |
83 | 83 | fs.rmSync(store); |
84 | 84 | |
85 | | -expect(logs.some((line) => line.includes("Runtime"))).toBe(true); |
| 85 | +expect(logs.join("\n")).toContain("Runtime"); |
86 | 86 | |
87 | 87 | const row = logs.find((line) => line.includes("agent:main:main")) ?? ""; |
88 | 88 | expect(row).toBe( |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -98,11 +98,11 @@ function getJoinedRuntimeLogs() {
|
98 | 98 | } |
99 | 99 | |
100 | 100 | function expectLogsInclude(logs: readonly string[], fragment: string) { |
101 | | -expect(logs.some((log) => log.includes(fragment))).toBe(true); |
| 101 | +expect(logs.join("\n")).toContain(fragment); |
102 | 102 | } |
103 | 103 | |
104 | 104 | function expectLogsExclude(logs: readonly string[], fragment: string) { |
105 | | -expect(logs.some((log) => log.includes(fragment))).toBe(false); |
| 105 | +expect(logs.join("\n")).not.toContain(fragment); |
106 | 106 | } |
107 | 107 | |
108 | 108 | function expectLogsMatch(logs: readonly string[], pattern: RegExp) { |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。