mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-07 10:21:25 +00:00
test: strengthen ports, tool policy, and note wrapping
This commit is contained in:
@@ -163,4 +163,26 @@ describe("wrapNoteMessage", () => {
|
||||
expect(wrapped).toContain("\n");
|
||||
expect(wrapped.replace(/\n/g, "")).toBe(input);
|
||||
});
|
||||
|
||||
it("wraps bullet lines while preserving bullet indentation", () => {
|
||||
const input = "- one two three four five six seven eight nine ten";
|
||||
const wrapped = wrapNoteMessage(input, { maxWidth: 18, columns: 80 });
|
||||
const lines = wrapped.split("\n");
|
||||
expect(lines.length).toBeGreaterThan(1);
|
||||
expect(lines[0]?.startsWith("- ")).toBe(true);
|
||||
expect(lines.slice(1).every((line) => line.startsWith(" "))).toBe(true);
|
||||
});
|
||||
|
||||
it("preserves long Windows paths without inserting spaces/newlines", () => {
|
||||
// No spaces: wrapNoteMessage splits on whitespace, so a "Program Files" style path would wrap.
|
||||
const input = "C:\\\\State\\\\OpenClaw\\\\bin\\\\openclaw.exe";
|
||||
const wrapped = wrapNoteMessage(input, { maxWidth: 10, columns: 80 });
|
||||
expect(wrapped).toBe(input);
|
||||
});
|
||||
|
||||
it("preserves UNC paths without inserting spaces/newlines", () => {
|
||||
const input = "\\\\\\\\server\\\\share\\\\some\\\\really\\\\long\\\\path\\\\file.txt";
|
||||
const wrapped = wrapNoteMessage(input, { maxWidth: 12, columns: 80 });
|
||||
expect(wrapped).toBe(input);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user