import { describe, expect, it } from "vitest"; import { parseWebDAVObjectKeys, webDAVCollectionUrl } from "./webDAV.ts"; describe("WebDAV E2E helpers", () => { it("builds an encoded collection URL below the configured endpoint", () => { expect( webDAVCollectionUrl({ endpoint: "http://127.0.0.1:8088/dav/" }, "Adaptive Journal/run one/").toString() ).toBe("http://127.0.0.1:8088/dav/Adaptive%20Journal/run%20one/"); }); it("extracts only flat object keys below the exact collection", () => { const collection = new URL("http://127.0.0.1:8088/dav/run/"); const xml = ` /dav/run/ /dav/run/a1~manifest.json /dav/run/a1~commit~writer~1.bin /dav/run/nested/ignored.bin /dav/sibling/ignored.bin `; expect(parseWebDAVObjectKeys(xml, collection)).toEqual(["a1~commit~writer~1.bin", "a1~manifest.json"]); }); });