mirror of
https://gitea.toothfairyai.com/ToothFairyAI/tf_code.git
synced 2026-04-03 23:53:46 +00:00
- Rename packages/opencode → packages/tfcode (directory only) - Rename bin/opencode → bin/tfcode (CLI binary) - Rename .opencode → .tfcode (config directory) - Update package.json name and bin field - Update config directory path references (.tfcode) - Keep internal code references as 'opencode' for easy upstream sync - Keep @opencode-ai/* workspace package names This minimal branding approach allows clean merges from upstream opencode repository while providing tfcode branding for users.
48 lines
1.3 KiB
TypeScript
48 lines
1.3 KiB
TypeScript
import { describe, expect, test } from "bun:test"
|
|
import type { PromptInfo } from "../../../../src/cli/cmd/tui/component/prompt/history"
|
|
import { assign, strip } from "../../../../src/cli/cmd/tui/component/prompt/part"
|
|
|
|
describe("prompt part", () => {
|
|
test("strip removes persisted ids from reused file parts", () => {
|
|
const part = {
|
|
id: "prt_old",
|
|
sessionID: "ses_old",
|
|
messageID: "msg_old",
|
|
type: "file" as const,
|
|
mime: "image/png",
|
|
filename: "tiny.png",
|
|
url: "data:image/png;base64,abc",
|
|
}
|
|
|
|
expect(strip(part)).toEqual({
|
|
type: "file",
|
|
mime: "image/png",
|
|
filename: "tiny.png",
|
|
url: "data:image/png;base64,abc",
|
|
})
|
|
})
|
|
|
|
test("assign overwrites stale runtime ids", () => {
|
|
const part = {
|
|
id: "prt_old",
|
|
sessionID: "ses_old",
|
|
messageID: "msg_old",
|
|
type: "file" as const,
|
|
mime: "image/png",
|
|
filename: "tiny.png",
|
|
url: "data:image/png;base64,abc",
|
|
} as PromptInfo["parts"][number]
|
|
|
|
const next = assign(part)
|
|
|
|
expect(next.id).not.toBe("prt_old")
|
|
expect(next.id.startsWith("prt_")).toBe(true)
|
|
expect(next).toMatchObject({
|
|
type: "file",
|
|
mime: "image/png",
|
|
filename: "tiny.png",
|
|
url: "data:image/png;base64,abc",
|
|
})
|
|
})
|
|
})
|