Files
backnotprop__plannotator/packages/server/annotate-doc-url.test.ts
Michael Ramos be2d06a7c2 Make HTML annotations render HTML by default
* feat(annotate): render html files by default

* fix(annotate): support raw html assets and sharing

* fix(annotate): address html first review followups

* fix(editor): avoid raw html sidebar init crash

* fix(annotate): support portable html shares

* fix(annotate): harden html share support

* fix(share): clear attachments when loading shared payloads

* fix(share): warn on remote share link failures

* perf(annotate): lazy-build html share payloads

* test(annotate): guard lazy html share generation

* test(annotate): drop flaky html share server test
2026-06-16 16:16:05 -07:00

44 lines
1.4 KiB
TypeScript

import { describe, expect, test } from "bun:test";
import { applyAnnotateDocSessionParams } from "./annotate-doc-url";
describe("applyAnnotateDocSessionParams", () => {
test("adds source base and markdown conversion for local HTML annotate sessions", () => {
const result = applyAnnotateDocSessionParams(
"http://localhost/api/doc?path=linked.html",
"/tmp/docs/page.html",
true,
);
const url = new URL(result.url);
expect(result.changed).toBe(true);
expect(url.searchParams.get("base")).toBe("/tmp/docs");
expect(url.searchParams.get("convert")).toBe("1");
});
test("does not override explicit doc request params", () => {
const result = applyAnnotateDocSessionParams(
"http://localhost/api/doc?path=linked.html&base=/custom&convert=0",
"/tmp/docs/page.html",
true,
);
const url = new URL(result.url);
expect(result.changed).toBe(false);
expect(url.searchParams.get("base")).toBe("/custom");
expect(url.searchParams.get("convert")).toBe("0");
});
test("skips local base injection for URL annotations", () => {
const result = applyAnnotateDocSessionParams(
"http://localhost/api/doc?path=linked.html",
"https://example.test/page.html",
true,
);
const url = new URL(result.url);
expect(result.changed).toBe(true);
expect(url.searchParams.has("base")).toBe(false);
expect(url.searchParams.get("convert")).toBe("1");
});
});