Add memorelay.test.ts

This commit is contained in:
Alex Gleason 2023-12-28 13:36:50 -06:00
parent 33eead2148
commit 2d19ab207e
No known key found for this signature in database
GPG Key ID: 7211D1F99744FBB7
1 changed files with 18 additions and 0 deletions

18
src/db/memorelay.test.ts Normal file
View File

@ -0,0 +1,18 @@
import { assertEquals } from '@/deps-test.ts';
import event1 from '~/fixtures/events/event-1.json' assert { type: 'json' };
import { memorelay } from './memorelay.ts';
Deno.test('memorelay', async () => {
assertEquals(memorelay.hasEvent(event1), false);
assertEquals(memorelay.hasEventById(event1.id), false);
memorelay.insertEvent(event1);
assertEquals(memorelay.hasEvent(event1), true);
assertEquals(memorelay.hasEventById(event1.id), true);
const result = await memorelay.getFilters([{ ids: [event1.id] }]);
assertEquals(result[0], event1);
});