* use import_map.json instead of per-file import * remove test_deps.ts in favor of import_map * remove common/deps.ts in favor of import_map * use import_map instead of server/deps.ts * make all plug-api files usable without an import_map * make all lib files usable without an import_map * remove web/deps.ts in favor of import_map * fix plug build * remove plug-api/deps.ts in favor of lib/deps.ts * fix server deps bundled in client deps
24 lines
663 B
TypeScript
24 lines
663 B
TypeScript
import { sleep } from "$lib/async.ts";
|
|
import { assertEquals } from "$std/testing/asserts.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());
|
|
});
|