test: strengthen ports, tool policy, and note wrapping

This commit is contained in:
Peter Steinberger
2026-02-16 01:31:06 +00:00
parent f50e1e8015
commit 4d9e310dad
3 changed files with 102 additions and 4 deletions

View File

@@ -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);
});
});