mirror of
https://gitlab.com/soapbox-pub/ditto.git
synced 2025-12-06 11:29:46 +00:00
test: attempt to use Postgres
This commit is contained in:
parent
d8247dc76a
commit
cbb48867c1
1 changed files with 6 additions and 11 deletions
|
|
@ -1,25 +1,16 @@
|
||||||
import { Database as Sqlite } from '@db/sqlite';
|
|
||||||
import { DenoSqlite3Dialect } from '@soapbox/kysely-deno-sqlite';
|
|
||||||
import { assertEquals, assertRejects } from '@std/assert';
|
import { assertEquals, assertRejects } from '@std/assert';
|
||||||
import { Kysely } from 'kysely';
|
|
||||||
import { generateSecretKey } from 'nostr-tools';
|
import { generateSecretKey } from 'nostr-tools';
|
||||||
|
|
||||||
import { Conf } from '@/config.ts';
|
import { Conf } from '@/config.ts';
|
||||||
import { DittoDB } from '@/db/DittoDB.ts';
|
import { DittoDB } from '@/db/DittoDB.ts';
|
||||||
import { DittoTables } from '@/db/DittoTables.ts';
|
|
||||||
import { RelayError } from '@/RelayError.ts';
|
import { RelayError } from '@/RelayError.ts';
|
||||||
import { EventsDB } from '@/storages/EventsDB.ts';
|
import { EventsDB } from '@/storages/EventsDB.ts';
|
||||||
import { eventFixture, genEvent } from '@/test.ts';
|
import { eventFixture, genEvent } from '@/test.ts';
|
||||||
|
|
||||||
/** Create in-memory database for testing. */
|
/** Create an database for testing. */
|
||||||
const createDB = async () => {
|
const createDB = async () => {
|
||||||
const kysely = new Kysely<DittoTables>({
|
const kysely = await DittoDB.getInstance();
|
||||||
dialect: new DenoSqlite3Dialect({
|
|
||||||
database: new Sqlite(':memory:'),
|
|
||||||
}),
|
|
||||||
});
|
|
||||||
const eventsDB = new EventsDB(kysely);
|
const eventsDB = new EventsDB(kysely);
|
||||||
await DittoDB.migrate(kysely);
|
|
||||||
return { eventsDB, kysely };
|
return { eventsDB, kysely };
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -221,3 +212,7 @@ Deno.test("throws a RelayError when querying an event with a large 'kind'", asyn
|
||||||
'kind filter too far into the future',
|
'kind filter too far into the future',
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Deno.test('query user by NIP-05 search filter', async () => {
|
||||||
|
// implement
|
||||||
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue