Files
t3code/packages/shared/src/String.test.ts
T
2026-06-03 16:16:53 -07:00

18 lines
476 B
TypeScript

import { describe, expect, it } from "vite-plus/test";
import { truncate } from "./String.ts";
describe("truncate", () => {
it("trims surrounding whitespace", () => {
expect(truncate(" hello world ")).toBe("hello world");
});
it("returns shorter strings unchanged", () => {
expect(truncate("alpha", 10)).toBe("alpha");
});
it("truncates long strings and appends an ellipsis", () => {
expect(truncate("abcdefghij", 5)).toBe("abcde...");
});
});