run: make minimal mode more minimal (#31227)

This commit is contained in:
Simon Klee 2026-06-07 23:26:14 +02:00 committed by GitHub
commit 07808bea12
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
39 changed files with 3109 additions and 930 deletions

View file

@ -1,5 +1,5 @@
import { afterEach, expect, test } from "bun:test"
import { openEditor } from "../src/editor"
import { normalizePromptContent, openEditor } from "../src/editor"
const editor = process.env.EDITOR
const visual = process.env.VISUAL
@ -21,3 +21,12 @@ test("rejects when the external editor cannot start", async () => {
await expect(openEditor({ value: "original", renderer: renderer as never })).rejects.toThrow()
})
test("normalizes a single trailing editor newline for one-line prompts", () => {
expect(normalizePromptContent("hello\n")).toBe("hello")
expect(normalizePromptContent("hello\r\n")).toBe("hello")
})
test("preserves multiline prompts that end with a newline", () => {
expect(normalizePromptContent("hello\nworld\n")).toBe("hello\nworld\n")
})