
      import { Temporal } from "@js-temporal/polyfill";
      import { URLPattern } from "urlpattern-polyfill";
      globalThis.addEventListener = () => {};
    
import "../lookup-Csp1y88W.js";
import { assertEquals } from "../assert_equals-DSbWqCm3.js";
import "../assert-MZs1qjMx.js";
import "../assert_instance_of-DHz7EHNU.js";
import { MemoryKvStore } from "../kv-CRZrzyXm.js";
import { createFederation, handleNodeInfo, handleNodeInfoJrd } from "../middleware-BuMF-mtE.js";
import "../client-pY7-3icS.js";
import "../types-C2XVl6gj.js";
import "../actor-BV5H5O8U.js";
import "../key-DpaoFQ82.js";
import "../http-CqzO68Am.js";
import "../ld-gP0eHSrh.js";
import "../owner-CuAVQ6t7.js";
import "../proof-BM2DN2Sn.js";
import "../docloader-C2NUa918.js";
import "../kv-cache-DN9pfMBe.js";
import "../inbox-us8YQR88.js";
import "../builder-rmwKTih6.js";
import "../collection-BzWsN9pB.js";
import "../keycache-DbuBfl7N.js";
import "../negotiation-C4nFufNk.js";
import "../retry-CfF8Gn4d.js";
import "../send-BDf5TQos.js";
import { createRequestContext, test } from "../testing-YUoSZp2V.js";
import "../std__assert-DWivtrGR.js";
import "../assert_rejects-Ce45JcFg.js";
import "../assert_throws-BNXdRGWP.js";
import "../assert_not_equals-C80BG-_5.js";

//#region src/nodeinfo/handler.test.ts
test("handleNodeInfo()", async () => {
	const request = new Request("https://example.com/nodeinfo/2.1");
	const federation = createFederation({ kv: new MemoryKvStore() });
	const context = createRequestContext({
		federation,
		data: void 0,
		request,
		url: new URL(request.url)
	});
	const nodeInfoDispatcher = (_ctx) => ({
		software: {
			name: "test",
			version: "1.2.3"
		},
		protocols: ["activitypub"],
		usage: {
			users: {
				total: 3,
				activeHalfyear: 2,
				activeMonth: 1
			},
			localPosts: 123,
			localComments: 456
		}
	});
	const response = await handleNodeInfo(request, {
		context,
		nodeInfoDispatcher
	});
	assertEquals(response.status, 200);
	assertEquals(response.headers.get("Content-Type"), "application/json; profile=\"http://nodeinfo.diaspora.software/ns/schema/2.1#\"");
	const json = await response.json();
	assertEquals(json, {
		"$schema": "http://nodeinfo.diaspora.software/ns/schema/2.1#",
		version: "2.1",
		software: {
			name: "test",
			version: "1.2.3"
		},
		protocols: ["activitypub"],
		services: {
			inbound: [],
			outbound: []
		},
		openRegistrations: false,
		usage: {
			users: {
				total: 3,
				activeHalfyear: 2,
				activeMonth: 1
			},
			localPosts: 123,
			localComments: 456
		},
		metadata: {}
	});
});
test("handleNodeInfoJrd()", async () => {
	const request = new Request("https://example.com/.well-known/nodeinfo");
	const federation = createFederation({ kv: new MemoryKvStore() });
	let context = createRequestContext({
		federation,
		data: void 0,
		request,
		url: new URL(request.url)
	});
	let response = await handleNodeInfoJrd(request, context);
	assertEquals(response.status, 200);
	assertEquals(response.headers.get("Content-Type"), "application/jrd+json");
	assertEquals(await response.json(), { links: [] });
	context = createRequestContext({
		...context,
		getNodeInfoUri() {
			return new URL("https://example.com/nodeinfo/2.1");
		}
	});
	response = await handleNodeInfoJrd(request, context);
	assertEquals(response.status, 200);
	assertEquals(response.headers.get("Content-Type"), "application/jrd+json");
	assertEquals(await response.json(), { links: [{
		href: "https://example.com/nodeinfo/2.1",
		rel: "http://nodeinfo.diaspora.software/ns/schema/2.1",
		type: "application/json; profile=\"http://nodeinfo.diaspora.software/ns/schema/2.1#\""
	}] });
});

//#endregion