import { afterEach, describe, expect, test } from "bun:test" import { handle, loadSource } from "../src/index" const changelog = `# Changelog ## v2.0.27 — 2026-10-12 ### Highlights - **Built-In Worktree Tools**: Use \`worktree_create\`. ([#53981](https://github.com/anomalyco/opencode/pull/53981)) ### Core #### Bug fixes - Fixed updater detection. (#54609) ## v2.0.26 — 2026-10-08 ### Core - Reduced snapshot overhead. ` const request = (path: string, method = "GET") => new Request(`https://opencode.ai${path}`, { method }) describe("handle", () => { test("renders every release with anchors, highlights and cache headers", async () => { const response = await handle(request("/changelog"), async () => changelog) const body = await response.text() expect(response.status).toBe(200) expect(response.headers.get("content-type")).toBe("text/html; charset=utf-8") expect(response.headers.get("cache-control")).toBe("public, max-age=60, s-maxage=300, stale-while-revalidate=86400") expect(body.indexOf('id="v2-0-27"')).toBeLessThan(body.indexOf('id="v2-0-26"')) expect(body).toContain('v2.0.27') expect(body).toContain('') expect(body).toContain('

Built-In Worktree Tools

') expect(body).toContain('
') expect(body).toContain('
') }) test("links the system status and lets its bundled script fetch the summary", async () => { const response = await handle(request("/changelog"), async () => changelog) const body = await response.text() const csp = response.headers.get("content-security-policy")?.split("; ") ?? [] expect(body).toContain('System status') const script = /