17 lines · 476 B · TypeScript
RawDownload
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...");  });});

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