
      import { Temporal } from "@js-temporal/polyfill";
      import { URLPattern } from "urlpattern-polyfill";
      globalThis.addEventListener = () => {};
    
import "../type-JlnIhtH5.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-AugJPLCs.js";
import { parseSemVer } from "../semver-dArNLkR9.js";
import "../client-C3LXvzgW.js";
import "../lookup-HkB8wBuC.js";
import "../types-BIgY6c-l.js";
import "../actor-ByBNJSWI.js";
import "../key-B90BCoJg.js";
import "../http-BAWnFKIC.js";
import "../authdocloader-Fd9MO0DV.js";
import "../ld-JP8y-E2v.js";
import "../owner-CNBDu6Ls.js";
import "../proof-ygmNitay.js";
import "../inbox-D2G1qO9A.js";
import "../builder-BTryr62J.js";
import "../collection-CSzG2j1P.js";
import "../keycache-Duhx-dKS.js";
import "../retry-D4GJ670a.js";
import "../send-xA5rO1BB.js";
import { createRequestContext, test } from "../testing-BANLO1B1.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: parseSemVer("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