Skip to content

Commit 071092a

Browse files
test(tui): cover unbranded sidebar footer Refs #39
1 parent e027128 commit 071092a

1 file changed

Lines changed: 35 additions & 0 deletions

File tree

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/** @jsxImportSource @opentui/solid */
2+
import { expect, test } from "bun:test"
3+
import { testRender } from "@opentui/solid"
4+
import { SidebarFooter } from "../../src/feature-plugins/sidebar/footer"
5+
import { TestTuiContexts } from "../fixture/tui-environment"
6+
import { createTuiPluginApi } from "../fixture/tui-plugin"
7+
8+
test("sidebar footer omits the product and version line", async () => {
9+
const api = createTuiPluginApi()
10+
Object.assign(api, { app: { version: "1.2.3" } })
11+
Object.assign(api.state, {
12+
path: { directory: "/work/redcode" },
13+
provider: [],
14+
vcs: { branch: "main" },
15+
})
16+
17+
const app = await testRender(
18+
() => (
19+
<TestTuiContexts cwd="/work/redcode" paths={{ home: "/work" }}>
20+
<SidebarFooter api={api} sessionID="session" />
21+
</TestTuiContexts>
22+
),
23+
{ width: 60, height: 12 },
24+
)
25+
26+
try {
27+
await app.renderOnce()
28+
const frame = app.captureCharFrame()
29+
expect(frame).toContain("~/redcode")
30+
expect(frame).not.toContain("OpenCode")
31+
expect(frame).not.toContain("1.2.3")
32+
} finally {
33+
app.renderer.destroy()
34+
}
35+
})

0 commit comments

Comments
 (0)