mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-07 17:41:22 +00:00
perf(test): fold ports + terminal note suites
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { visibleWidth } from "./ansi.js";
|
||||
import { wrapNoteMessage } from "./note.js";
|
||||
import { renderTable } from "./table.js";
|
||||
|
||||
describe("renderTable", () => {
|
||||
@@ -130,3 +131,36 @@ describe("renderTable", () => {
|
||||
expect(line2Index).toBe(line1Index + 1);
|
||||
});
|
||||
});
|
||||
|
||||
describe("wrapNoteMessage", () => {
|
||||
it("preserves long filesystem paths without inserting spaces/newlines", () => {
|
||||
const input =
|
||||
"/Users/user/Documents/Github/impact-signals-pipeline/with/really/long/segments/file.txt";
|
||||
const wrapped = wrapNoteMessage(input, { maxWidth: 22, columns: 80 });
|
||||
|
||||
expect(wrapped).toBe(input);
|
||||
});
|
||||
|
||||
it("preserves long urls without inserting spaces/newlines", () => {
|
||||
const input =
|
||||
"https://example.com/this/is/a/very/long/url/segment/that/should/not/be/split/for-copy";
|
||||
const wrapped = wrapNoteMessage(input, { maxWidth: 24, columns: 80 });
|
||||
|
||||
expect(wrapped).toBe(input);
|
||||
});
|
||||
|
||||
it("preserves long file-like underscore tokens for copy safety", () => {
|
||||
const input = "administrators_authorized_keys_with_extra_suffix";
|
||||
const wrapped = wrapNoteMessage(input, { maxWidth: 14, columns: 80 });
|
||||
|
||||
expect(wrapped).toBe(input);
|
||||
});
|
||||
|
||||
it("still chunks generic long opaque tokens to avoid pathological line width", () => {
|
||||
const input = "x".repeat(70);
|
||||
const wrapped = wrapNoteMessage(input, { maxWidth: 20, columns: 80 });
|
||||
|
||||
expect(wrapped).toContain("\n");
|
||||
expect(wrapped.replace(/\n/g, "")).toBe(input);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user