From ed20e5e10c4e09da9650abcd15063ce6a241b0b6 Mon Sep 17 00:00:00 2001 From: Shakker Date: Tue, 12 May 2026 21:57:00 +0100 Subject: [PATCH] test: present command output text --- src/commands/dashboard.links.test.ts | 4 ++-- src/commands/sessions.test.ts | 4 ++-- src/commands/status.test.ts | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/commands/dashboard.links.test.ts b/src/commands/dashboard.links.test.ts index 42cfe7c3f06..6c85353783b 100644 --- a/src/commands/dashboard.links.test.ts +++ b/src/commands/dashboard.links.test.ts @@ -47,11 +47,11 @@ function logMessages(): string[] { } function expectLogWith(text: string): void { - expect(logMessages().some((message) => message.includes(text))).toBe(true); + expect(logMessages().join("\n")).toContain(text); } function expectNoLogWith(text: string): void { - expect(logMessages().some((message) => message.includes(text))).toBe(false); + expect(logMessages().join("\n")).not.toContain(text); } function mockSnapshot(token: unknown = "abc") { diff --git a/src/commands/sessions.test.ts b/src/commands/sessions.test.ts index c9c6d168090..3ce01cc02a3 100644 --- a/src/commands/sessions.test.ts +++ b/src/commands/sessions.test.ts @@ -45,7 +45,7 @@ describe("sessionsCommand", () => { fs.rmSync(store); - expect(logs.some((line) => line.includes("Tokens (ctx %"))).toBe(true); + expect(logs.join("\n")).toContain("Tokens (ctx %"); const row = logs.find((line) => line.includes("+15555550123")) ?? ""; expect(row).toBe( @@ -82,7 +82,7 @@ describe("sessionsCommand", () => { fs.rmSync(store); - expect(logs.some((line) => line.includes("Runtime"))).toBe(true); + expect(logs.join("\n")).toContain("Runtime"); const row = logs.find((line) => line.includes("agent:main:main")) ?? ""; expect(row).toBe( diff --git a/src/commands/status.test.ts b/src/commands/status.test.ts index 57896cd2d5b..bcfd98338fa 100644 --- a/src/commands/status.test.ts +++ b/src/commands/status.test.ts @@ -98,11 +98,11 @@ function getJoinedRuntimeLogs() { } function expectLogsInclude(logs: readonly string[], fragment: string) { - expect(logs.some((log) => log.includes(fragment))).toBe(true); + expect(logs.join("\n")).toContain(fragment); } function expectLogsExclude(logs: readonly string[], fragment: string) { - expect(logs.some((log) => log.includes(fragment))).toBe(false); + expect(logs.join("\n")).not.toContain(fragment); } function expectLogsMatch(logs: readonly string[], pattern: RegExp) {