import "@js-temporal/polyfill";
import "urlpattern-polyfill";
globalThis.addEventListener = () => {};
import { C as Person, u as Follow } from "../vocab-C5EUmVTj.mjs";
import { t as test } from "../testing-BQeTO4ss.mjs";
import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
import { t as assertInstanceOf } from "../assert_instance_of-C4Ri6VuN.mjs";
import { t as assert } from "../assert-DikXweDx.mjs";
import { t as MemoryKvStore } from "../kv-OuT2IU64.mjs";
import { _ as actorDehydrator, n as FederationImpl, v as autoIdAssigner } from "../middleware-C26Vj2UM.mjs";
//#region src/compat/transformers.test.ts
const context = new FederationImpl({ kv: new MemoryKvStore() }).createContext(new URL("http://example.com/"));
test("autoIdAssigner", async () => {
	const result = autoIdAssigner(new Follow({
		actor: new URL("http://example.com/actors/1"),
		object: new Person({
			id: new URL("http://example.com/actors/2"),
			name: "Bob",
			preferredUsername: "bob"
		})
	}), context);
	const { id } = result;
	assertInstanceOf(id, URL);
	assertEquals(id.origin, "http://example.com");
	assertEquals(id.pathname, "/");
	assertEquals(id.search, "");
	assert(id.hash.match(/^#Follow\/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/));
	assertEquals(await result.toJsonLd(), await new Follow({
		id,
		actor: new URL("http://example.com/actors/1"),
		object: new Person({
			id: new URL("http://example.com/actors/2"),
			name: "Bob",
			preferredUsername: "bob"
		})
	}).toJsonLd());
});
test("actorDehydrator()", async () => {
	assertEquals(await actorDehydrator(new Follow({
		id: new URL("http://example.com/activities/1"),
		actor: new Person({
			id: new URL("http://example.com/actors/1"),
			name: "Alice",
			preferredUsername: "alice"
		}),
		object: new Person({
			id: new URL("http://example.com/actors/2"),
			name: "Bob",
			preferredUsername: "bob"
		})
	}), context).toJsonLd(), await new Follow({
		id: new URL("http://example.com/activities/1"),
		actor: new URL("http://example.com/actors/1"),
		object: new Person({
			id: new URL("http://example.com/actors/2"),
			name: "Bob",
			preferredUsername: "bob"
		})
	}).toJsonLd());
});
//#endregion
export {};
