a2dbf7b3db
* Prep for in-process plug loading (e.g. for CF workers, Deno Deploy) * Prototype of fixed in-process loading plugs * Fix: buttons not to scroll with content * Better positioning of modal especially on mobile * Move query caching outside query * Fix annoying mouse behavior when filter box appears * Page navigator search tweaks
24 lines
661 B
TypeScript
24 lines
661 B
TypeScript
import { sleep } from "$sb/lib/async.ts";
|
|
import { assertEquals } from "../../test_deps.ts";
|
|
import { LimitedMap } from "./limited_map.ts";
|
|
|
|
Deno.test("limited map", async () => {
|
|
const mp = new LimitedMap<string>(3);
|
|
mp.set("a", "a");
|
|
mp.set("b", "b", 5);
|
|
mp.set("c", "c");
|
|
assertEquals(mp.get("a"), "a");
|
|
assertEquals(mp.get("b"), "b");
|
|
assertEquals(mp.get("c"), "c");
|
|
// Drops the first key
|
|
mp.set("d", "d");
|
|
// console.log(mp.toJSON());
|
|
assertEquals(mp.get("a"), undefined);
|
|
await sleep(10);
|
|
// "b" should have been dropped
|
|
assertEquals(mp.get("b"), undefined);
|
|
assertEquals(mp.get("c"), "c");
|
|
|
|
console.log(mp.toJSON());
|
|
});
|