
      import { Temporal } from "@js-temporal/polyfill";
      import { URLPattern } from "urlpattern-polyfill";
      globalThis.addEventListener = () => {};
    
import "../type-BSR-vRXo.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-DxS7Csvz.js";
import "../client-KUXReLjS.js";
import "../lookup-q8DeFAjR.js";
import "../types-BSuWJsOm.js";
import "../actor-By5NMImS.js";
import "../key-B057bXm0.js";
import "../http-CCydyMoV.js";
import "../authdocloader-lhbaj4KA.js";
import "../ld-CxJe2x7_.js";
import "../owner-jwXilm3L.js";
import "../proof-CHi36V0T.js";
import "../inbox-DH8TXk1f.js";
import "../builder-B6AupxqD.js";
import "../collection-CcnIw1qY.js";
import "../keycache-CB_VjDe0.js";
import "../negotiation-5NPJL6zp.js";
import "../retry-D4GJ670a.js";
import "../send-CwVrwo7j.js";
import { createRequestContext, test } from "../testing-Cqwzq9nj.js";
import "../std__assert-X-_kMxKM.js";
import "../assert_rejects-DiIiJbZn.js";
import "../assert_is_error-BPGph1Jx.js";
import "../assert_not_equals-f3m3epl3.js";
import "../assert_throws-BOO88avQ.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