
      import { Temporal } from "@js-temporal/polyfill";
      import { URLPattern } from "urlpattern-polyfill";
      globalThis.addEventListener = () => {};
    
import "../lookup-Dvhilldd.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 { test } from "../testing-cwlO8Sns.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/federation/kv.test.ts
test("MemoryKvStore", async (t) => {
	const store = new MemoryKvStore();
	await t.step("set() & get()", async () => {
		await store.set(["foo", "bar"], "foobar");
		assertEquals(await store.get(["foo", "bar"]), "foobar");
		assertEquals(await store.get(["foo"]), void 0);
		await store.set(["foo", "baz"], "baz", { ttl: Temporal.Duration.from({ seconds: 0 }) });
		await new Promise((resolve) => setTimeout(resolve, 10));
		assertEquals(await store.get(["foo", "baz"]), void 0);
	});
	await t.step("delete()", async () => {
		await store.delete(["foo", "bar"]);
		assertEquals(await store.get(["foo", "bar"]), void 0);
	});
	await t.step("cas()", async () => {
		await store.set(["foo", "bar"], "foobar");
		assertEquals(await store.cas(["foo", "bar"], "bar", "baz"), false);
		assertEquals(await store.get(["foo", "bar"]), "foobar");
		assertEquals(await store.cas(["foo", "bar"], "foobar", "baz"), true);
		assertEquals(await store.get(["foo", "bar"]), "baz");
		await store.delete(["foo", "bar"]);
		assertEquals(await store.cas(["foo", "bar"], "foobar", "baz"), false);
		assertEquals(await store.get(["foo", "bar"]), void 0);
		assertEquals(await store.cas(["foo", "bar"], void 0, "baz"), true);
		assertEquals(await store.get(["foo", "bar"]), "baz");
	});
});

//#endregion