17 lines · 506 B · TypeScript
RawDownload
import { describe, expect, it } from "vitest"; import { truncateTitle } from "./truncateTitle"; describe("truncateTitle", () => {  it("trims surrounding whitespace", () => {    expect(truncateTitle("   hello world   ")).toBe("hello world");  });   it("returns trimmed text when within max length", () => {    expect(truncateTitle("alpha", 10)).toBe("alpha");  });   it("appends ellipsis when text exceeds max length", () => {    expect(truncateTitle("abcdefghij", 5)).toBe("abcde...");  });});

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t