refactor(tui): inline reverted prompt mapping

This commit is contained in:
Aiden Cline 2026-07-13 02:44:59 +00:00 committed by 𝓛𝓲𝓽𝓽𝓵𝓮 𝓕𝓻𝓪𝓷𝓴
commit 1302f229fe
4 changed files with 30 additions and 62 deletions

View file

@ -1,39 +0,0 @@
import { describe, expect, test } from "bun:test"
import type { SessionMessageUser } from "@opencode-ai/client"
import { revertedPrompt } from "../../src/util/revert-prompt"
describe("reverted prompt", () => {
test("restores message text and references", () => {
const message = {
id: "message-1",
type: "user",
text: "Fix @test.ts with @review",
time: { created: 1 },
files: [
{
mime: "text/typescript",
name: "test.ts",
description: "test file",
data: "",
source: { type: "uri", uri: "file:///repo/test.ts" },
mention: { start: 4, end: 12, text: "@test.ts" },
},
],
agents: [{ name: "review", mention: { start: 18, end: 25, text: "@review" } }],
} satisfies SessionMessageUser
expect(revertedPrompt(message)).toEqual({
text: "Fix @test.ts with @review",
files: [
{
uri: "file:///repo/test.ts",
name: "test.ts",
description: "test file",
mention: { start: 4, end: 12, text: "@test.ts" },
},
],
agents: [{ name: "review", mention: { start: 18, end: 25, text: "@review" } }],
pasted: [],
})
})
})