mirror of
https://gitlab.com/soapbox-pub/ditto.git
synced 2025-12-06 11:29:46 +00:00
25 lines
680 B
TypeScript
25 lines
680 B
TypeScript
import { DittoConf } from '@ditto/conf';
|
|
import { NPostgres } from '@nostrify/db';
|
|
import { genEvent } from '@nostrify/nostrify/test';
|
|
import { assertEquals } from '@std/assert';
|
|
|
|
import { DittoPolyPg } from './DittoPolyPg.ts';
|
|
import { TestDB } from './TestDB.ts';
|
|
|
|
Deno.test('TestDB', async () => {
|
|
const conf = new DittoConf(Deno.env);
|
|
const orig = new DittoPolyPg(conf.databaseUrl);
|
|
|
|
await using db = new TestDB(orig);
|
|
await db.migrate();
|
|
await db.clear();
|
|
|
|
const store = new NPostgres(orig.kysely);
|
|
await store.event(genEvent());
|
|
|
|
assertEquals((await store.count([{}])).count, 1);
|
|
|
|
await db.clear();
|
|
|
|
assertEquals((await store.count([{}])).count, 0);
|
|
});
|