@fedify/fedify
Version:
An ActivityPub server framework
33 lines (29 loc) • 1.6 kB
JavaScript
import { Temporal } from "@js-temporal/polyfill";
import { URLPattern } from "urlpattern-polyfill";
globalThis.addEventListener = () => {};
import { assertEquals } from "../assert_equals-CTYbeopb.js";
import "../assert-DmFG7ppO.js";
import "../assert_instance_of-CF09JHYM.js";
import { buildCollectionSynchronizationHeader, digest } from "../collection-Dfb0TPno.js";
import { test } from "../testing-BZ0dJ4qn.js";
import "../std__assert-vp0TKMS1.js";
import "../assert_rejects-C-sxEMM5.js";
import "../assert_is_error-nrwA1GeT.js";
import "../assert_not_equals-Dc7y-V5Q.js";
import "../assert_throws-Cn9C6Jur.js";
import { decodeHex } from "byte-encodings/hex";
//#region federation/collection.test.ts
test("digest()", async () => {
const uris = [
new URL("https://testing.example.org/users/1"),
new URL("https://testing.example.org/users/2"),
new URL("https://testing.example.org/users/2")
];
const result = await digest(uris);
assertEquals(result, decodeHex("c33f48cd341ef046a206b8a72ec97af65079f9a3a9b90eef79c5920dce45c61f"));
});
test("buildCollectionSynchronizationHeader()", async () => {
const header = await buildCollectionSynchronizationHeader("https://testing.example.org/users/1/followers", ["https://testing.example.org/users/2", "https://testing.example.org/users/1"]);
assertEquals(header, "collectionId=\"https://testing.example.org/users/1/followers\", url=\"https://testing.example.org/users/1/followers?base-url=https%3A%2F%2Ftesting.example.org%2F\", digest=\"c33f48cd341ef046a206b8a72ec97af65079f9a3a9b90eef79c5920dce45c61f\"");
});
//#endregion