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
parent 914a643ab2
commit 07808bea12
39 changed files with 3138 additions and 959 deletions
+10 -1
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")
})