mirror of
https://gitlab.com/soapbox-pub/ditto.git
synced 2025-12-06 11:29:46 +00:00
createTestDB: don't accept an arg
This commit is contained in:
parent
f3ae200833
commit
fad40f1c30
1 changed files with 6 additions and 5 deletions
11
src/test.ts
11
src/test.ts
|
|
@ -31,10 +31,11 @@ export function genEvent(t: Partial<NostrEvent> = {}, sk: Uint8Array = generateS
|
||||||
return purifyEvent(event);
|
return purifyEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Create an database for testing. */
|
/** Create a database for testing. It uses `TEST_DATABASE_URL`, or creates an in-memory database by default. */
|
||||||
export const createTestDB = async (databaseUrl = Conf.testDatabaseUrl) => {
|
export async function createTestDB() {
|
||||||
const { protocol } = new URL(databaseUrl);
|
const { testDatabaseUrl } = Conf;
|
||||||
const { kysely } = DittoDB.create(databaseUrl, { poolSize: 1 });
|
const { protocol } = new URL(testDatabaseUrl);
|
||||||
|
const { kysely } = DittoDB.create(testDatabaseUrl, { poolSize: 1 });
|
||||||
|
|
||||||
await DittoDB.migrate(kysely);
|
await DittoDB.migrate(kysely);
|
||||||
const store = new EventsDB(kysely);
|
const store = new EventsDB(kysely);
|
||||||
|
|
@ -65,7 +66,7 @@ export const createTestDB = async (databaseUrl = Conf.testDatabaseUrl) => {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
};
|
}
|
||||||
|
|
||||||
export function sleep(ms: number): Promise<void> {
|
export function sleep(ms: number): Promise<void> {
|
||||||
return new Promise((resolve) => setTimeout(resolve, ms));
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue