blowater/UI/config-other.test.ts
BlowaterNostr a2e4391aff
Remove automerge (#303)
automerge was a fun experiment but
1. It's a black box & hard to debug
2. replaceable event is flawed
I still believe in CRDT and I need to implement my own in the future to work best with Nostr
2023-11-19 01:49:08 +08:00

23 lines
745 B
TypeScript

import { assertEquals, fail } from "https://deno.land/std@0.176.0/testing/asserts.ts";
import { OtherConfig } from "./config-other.ts";
import { InMemoryAccountContext } from "../lib/nostr-ts/nostr.ts";
Deno.test("Pin List", async () => {
const ctx = InMemoryAccountContext.Generate();
const config = OtherConfig.Empty();
config.addPin("a");
assertEquals(config.getPinList(), new Set(["a"]));
config.addPin("b");
assertEquals(config.getPinList(), new Set(["a", "b"]));
const err = await config.saveToLocalStorage(ctx);
if (err instanceof Error) fail(err.message);
{
const config = await OtherConfig.FromLocalStorage(ctx);
assertEquals(config.getPinList(), new Set(["a", "b"]));
}
});