mirror of
https://github.com/backnotprop/plannotator.git
synced 2026-09-14 14:17:26 +08:00
be2d06a7c2
* 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
44 lines
1.4 KiB
TypeScript
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");
|
|
});
|
|
});
|