mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-11 17:21:13 +00:00
* ACP: sanitize terminal tool titles Co-authored-by: nexrin <268879349+nexrin@users.noreply.github.com> * Config: refresh config baseline and stabilize restart pid test --------- Co-authored-by: nexrin <268879349+nexrin@users.noreply.github.com>
17 lines
557 B
TypeScript
17 lines
557 B
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { sanitizeTerminalText } from "./safe-text.js";
|
|
|
|
describe("sanitizeTerminalText", () => {
|
|
it("removes C1 control characters", () => {
|
|
expect(sanitizeTerminalText("a\u009bb\u0085c")).toBe("abc");
|
|
});
|
|
|
|
it("strips cursor and erase ANSI sequences", () => {
|
|
expect(sanitizeTerminalText("\u001b[2K\u001b[1Arewritten")).toBe("rewritten");
|
|
});
|
|
|
|
it("escapes line controls while preserving printable text", () => {
|
|
expect(sanitizeTerminalText("a\tb\nc\rd")).toBe("a\\tb\\nc\\rd");
|
|
});
|
|
});
|