mirror of
https://github.com/BlowaterNostr/blowater.git
synced 2024-10-18 15:43:20 +00:00
a2e4391aff
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
23 lines
745 B
TypeScript
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"]));
|
|
}
|
|
});
|