The best way to control Claude Code, Codex and more from any computer or phone

main
ts 14 lines 428 Bytes
Raw
1 import { describe, expect, it } from "vite-plus/test";
2
3 import { truncate } from "./String.ts";
4
5 describe("truncate", () => {
6 it("cuts by Unicode code point so emoji stay whole", () => {
7 expect(truncate("👍👍👍", 5)).toBe("👍👍👍");
8 expect(truncate("👍👍👍👍", 3)).toBe("👍👍👍...");
9 });
10
11 it("trims before measuring", () => {
12 expect(truncate(" hello ", 5)).toBe("hello");
13 });
14 });