| 1 | import { expect, test } from "bun:test"; |
| 2 | |
| 3 | // Run against alchemy dev or a deployed Cloudflare site: |
| 4 | // VOCS_URL=http://localhost:1337 bun test test/markdown.test.ts |
| 5 | // TODO(upstream Vocs): support Markdown on Cloudflare without patching internal |
| 6 | // middleware. Dev needs host-side compilation; production needs asset-binding |
| 7 | // access and content negotiation before static HTML. No upstream issue filed yet. |
| 8 | const url = process.env.VOCS_URL; |
| 9 | |
| 10 | (url ? test.failing : test.skip)( |
| 11 | "TODO upstream: Cloudflare Vocs serves negotiated Markdown", |
| 12 | async () => { |
| 13 | const response = await fetch(new URL("/guide", url), { |
| 14 | headers: { accept: "text/markdown" }, |
| 15 | signal: AbortSignal.timeout(15_000), |
| 16 | }); |
| 17 | expect(response.status).toBe(200); |
| 18 | expect(response.headers.get("content-type")).toContain("text/markdown"); |
| 19 | expect(await response.text()).toContain("# Deployment guide"); |
| 20 | }, |
| 21 | 20_000, |
| 22 | ); |