Skip to main content
This release is 23 versions behind 1.4.9 — the latest version of @fedify/fedify. Jump to latest

Built and signed on GitHub Actions

An ActivityPub/fediverse server framework

This package works with Node.js, Deno, Bun
This package works with Node.js
This package works with Deno
This package works with Bun
JSR Score
94%
Published
3 months ago (1.3.3)
Package root>federation>collection.test.ts
import { assertEquals } from "jsr:@std/assert@^0.226.0"; import { decodeHex } from "jsr:/@std/encoding@^1.0.5/hex"; import { test } from "../testing/mod.ts"; import { buildCollectionSynchronizationHeader, digest } from "./collection.ts"; test("digest()", async () => { // See also: // https://codeberg.org/fediverse/fep/src/branch/main/fep/8fcf/fep-8fcf.md#partial-follower-collection-digest 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"), // dup ]; 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"', ); }); // cSpell: ignore 2Ftesting