mirror of
https://github.com/moltbot/moltbot.git
synced 2026-05-16 18:34:18 +00:00
test: display cli output text
This commit is contained in:
@@ -166,15 +166,15 @@ function requireWriteOptions(): { unsetPaths?: string[][]; explicitSetPaths?: st
|
||||
}
|
||||
|
||||
function expectLogIncludes(text: string) {
|
||||
expect(mockLog.mock.calls.some((call) => String(call[0]).includes(text))).toBe(true);
|
||||
expect(mockLog.mock.calls.map((call) => String(call[0])).join("\n")).toContain(text);
|
||||
}
|
||||
|
||||
function expectLogExcludes(text: string) {
|
||||
expect(mockLog.mock.calls.some((call) => String(call[0]).includes(text))).toBe(false);
|
||||
expect(mockLog.mock.calls.map((call) => String(call[0])).join("\n")).not.toContain(text);
|
||||
}
|
||||
|
||||
function expectErrorIncludes(text: string) {
|
||||
expect(mockError.mock.calls.some((call) => String(call[0]).includes(text))).toBe(true);
|
||||
expect(mockError.mock.calls.map((call) => String(call[0])).join("\n")).toContain(text);
|
||||
}
|
||||
|
||||
function requireRecord(value: unknown, label: string): Record<string, unknown> {
|
||||
|
||||
@@ -134,11 +134,11 @@ function runtimeErrorMessages(): string[] {
|
||||
}
|
||||
|
||||
function expectRuntimeErrorContaining(text: string): void {
|
||||
expect(runtimeErrorMessages().some((message) => message.includes(text))).toBe(true);
|
||||
expect(runtimeErrorMessages().join("\n")).toContain(text);
|
||||
}
|
||||
|
||||
function expectNoRuntimeErrorContaining(text: string): void {
|
||||
expect(runtimeErrorMessages().some((message) => message.includes(text))).toBe(false);
|
||||
expect(runtimeErrorMessages().join("\n")).not.toContain(text);
|
||||
}
|
||||
|
||||
function stdoutText(): string {
|
||||
|
||||
@@ -32,6 +32,6 @@ describe("formatCliFailureLines", () => {
|
||||
"[openclaw] Stack:",
|
||||
"[openclaw] Error: boom",
|
||||
]);
|
||||
expect(lines.some((line) => line.includes("Error: boom"))).toBe(true);
|
||||
expect(lines.join("\n")).toContain("Error: boom");
|
||||
});
|
||||
});
|
||||
|
||||
@@ -31,7 +31,7 @@ function requireMockCallArg(
|
||||
}
|
||||
|
||||
function expectRuntimeLogIncludes(fragment: string) {
|
||||
expect(runtimeLogs.some((log) => log.includes(fragment))).toBe(true);
|
||||
expect(runtimeLogs.join("\n")).toContain(fragment);
|
||||
}
|
||||
|
||||
describe("persistPluginInstall", () => {
|
||||
|
||||
Reference in New Issue
Block a user