mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-10 13:44:58 +00:00
refactor(commands): centralize shared command formatting helpers
This commit is contained in:
16
src/commands/text-format.test.ts
Normal file
16
src/commands/text-format.test.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { shortenText } from "./text-format.js";
|
||||
|
||||
describe("shortenText", () => {
|
||||
it("returns original text when it fits", () => {
|
||||
expect(shortenText("openclaw", 16)).toBe("openclaw");
|
||||
});
|
||||
|
||||
it("truncates and appends ellipsis when over limit", () => {
|
||||
expect(shortenText("openclaw-status-output", 10)).toBe("openclaw-…");
|
||||
});
|
||||
|
||||
it("counts multi-byte characters correctly", () => {
|
||||
expect(shortenText("hello🙂world", 7)).toBe("hello🙂…");
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user