a48e16037b
- Extracted `renderWelcomeTip` as a standalone exported function. - Replaced truncation with `wrapTextWithAnsi` so long tips wrap under the label. - Added test asserting multi-line output stays within box width without ellipsis.
21 lines
815 B
TypeScript
21 lines
815 B
TypeScript
import { describe, expect, it } from "bun:test";
|
|
import { renderWelcomeTip } from "@oh-my-pi/pi-coding-agent/modes/components/welcome";
|
|
import { visibleWidth } from "@oh-my-pi/pi-tui";
|
|
|
|
describe("renderWelcomeTip", () => {
|
|
it("wraps long tips under the label instead of truncating", () => {
|
|
const tip = "Next time you see spaghetti try creating a TTSR rule that prevents this pattern before it spreads";
|
|
const width = 44;
|
|
const lines = renderWelcomeTip(tip, width);
|
|
const plain = lines.map(line => Bun.stripANSI(line));
|
|
|
|
expect(plain.length).toBeGreaterThan(1);
|
|
expect(plain.join(" ")).not.toContain("…");
|
|
expect(plain[0]).toStartWith(" Tip: Next time");
|
|
expect(plain[1]).toStartWith(" ");
|
|
for (const line of plain) {
|
|
expect(visibleWidth(line)).toBeLessThanOrEqual(width);
|
|
}
|
|
});
|
|
});
|