This commit is contained in:
BlowaterNostr 2024-03-26 00:02:51 +08:00
parent c1d6ff9239
commit 65d48bac4b
2 changed files with 14 additions and 20 deletions

View File

@ -1,4 +1,11 @@
import { Database_View, EventMark, EventMarker, EventsAdapter, Indices, RelayRecorder } from "../database.ts"; import {
Database_View,
EventMark,
EventMarker,
EventsAdapter,
Indices,
RelayRecorderBloomFilter,
} from "../database.ts";
import { EventBus } from "../event-bus.ts"; import { EventBus } from "../event-bus.ts";
import { NostrEvent } from "../../libs/nostr.ts/nostr.ts"; import { NostrEvent } from "../../libs/nostr.ts/nostr.ts";
import { UI_Interaction_Event } from "./app_update.tsx"; import { UI_Interaction_Event } from "./app_update.tsx";
@ -23,21 +30,6 @@ export async function test_db_view() {
}, },
}; };
const relays = new Map<string, Set<string>>();
const testRelayRecorder: RelayRecorder = {
setRelayRecord: async (eventID: string, url: string) => {
const records = relays.get(eventID);
if (records) {
records.add(url);
} else {
relays.set(eventID, new Set([url]));
}
},
getAllRelayRecords: async () => {
return relays;
},
};
const marks = new Map<string, EventMark>(); const marks = new Map<string, EventMark>();
const testEventMarker: EventMarker = { const testEventMarker: EventMarker = {
getMark: async (eventID: string) => { getMark: async (eventID: string) => {
@ -53,5 +45,9 @@ export async function test_db_view() {
return Array.from(marks.values()); return Array.from(marks.values());
}, },
}; };
return await Database_View.New(testEventsAdapter, testRelayRecorder, testEventMarker); return await Database_View.New(
testEventsAdapter,
RelayRecorderBloomFilter.FromLocalStorage(),
testEventMarker,
);
} }

View File

@ -104,9 +104,7 @@ Deno.test("Relay Record", async () => {
await stream.pop(); await stream.pop();
await stream.pop(); await stream.pop();
await stream.pop();
const isCanceled = await sleep(10, stream.pop());
assertEquals(isCanceled, not_cancelled);
}); });
Deno.test("mark removed event", async () => { Deno.test("mark removed event", async () => {