- 品牌替换:OpenCode/opencode → AirCoding/aircoding(16+ 文件) - Logo ASCII art:修复 left/right 行数不匹配导致的启动崩溃 - 启动诊断:添加 OPENCODE_PRINT_TIMING 计时探针 - dev 模式默认 --pure 跳过外部插件加载 - AGENTS.md 模板:追加 AirCoding 多 Agent 专项段落 - architect prompt + plugin:强化 AGENTS.md 产出验证
38 lines
1.2 KiB
TypeScript
38 lines
1.2 KiB
TypeScript
import { expect, test } from "bun:test"
|
|
import { testRender } from "@opentui/solid"
|
|
import { abbreviateHome } from "../src/runtime"
|
|
import { TuiPathsProvider, useTuiPaths } from "../src/context/runtime"
|
|
|
|
test("abbreviates paths within home boundaries", () => {
|
|
expect(abbreviateHome("/home/test", "/home/test")).toBe("~")
|
|
expect(abbreviateHome("/home/test/project", "/home/test")).toBe("~/project")
|
|
expect(abbreviateHome("/home/tester/project", "/home/test")).toBe("/home/tester/project")
|
|
expect(abbreviateHome("/tmp/project", "/home/test")).toBe("/tmp/project")
|
|
})
|
|
|
|
test("provides focused immutable runtime inputs", async () => {
|
|
let paths: ReturnType<typeof useTuiPaths>
|
|
|
|
function Runtime() {
|
|
paths = useTuiPaths()
|
|
return <text>{paths.cwd}</text>
|
|
}
|
|
|
|
const app = await testRender(
|
|
() => (
|
|
<TuiPathsProvider value={{ cwd: "/work", home: "/home/test", state: "/state", worktree: "/worktree" }}>
|
|
<Runtime />
|
|
</TuiPathsProvider>
|
|
),
|
|
{ width: 40, height: 3 },
|
|
)
|
|
|
|
try {
|
|
await app.renderOnce()
|
|
expect(app.captureCharFrame()).toContain("/work")
|
|
expect(Object.isFrozen(paths!)).toBe(true)
|
|
} finally {
|
|
app.renderer.destroy()
|
|
}
|
|
})
|