import { expect, test } from "bun:test";
import { read } from "./read.ts";
/* PAGE */
const BODY = `
`;
const BOX = `{"page":{"kind":"code","title":"read.ts","props":{"body":""}},"chrome":{"route":"/git/site/read.ts","catalog":[],"fly":false,"now":1790017200000}}`;
const HTML = `\nread.tsSkip to content\n`;
/* READ */
test("the reader takes the props box off a served page and fills the body from its data-body element", () => {
const view = read(HTML);
expect(view?.page.kind).toBe("code");
expect(view?.chrome.route).toBe("/git/site/read.ts");
expect(view?.page.props.body).toBe(BODY);
});
test("a served page with no props box reads as nothing, so the router falls back to a full load", () => {
expect(read(HTML.replace(/