refactor(test.ts): explain why set DATABASE_URL to sqlite://:memory:

This commit is contained in:
P. Reis 2024-07-05 17:59:12 -03:00
parent 1af229da45
commit 7e965f4ade

View file

@ -96,7 +96,10 @@ export const createTestDB = async (databaseUrl?: string) => {
let kysely: Kysely<DittoTables>;
if (dialect === 'sqlite') {
Deno.env.set('DATABASE_URL', 'sqlite://:memory:'); // hack, refactor all, 021 migration
// migration 021_pgfts_index.ts calls 'Conf.db.dialect',
// and this calls the DATABASE_URL environment variable.
// The following line ensures to NOT use the DATABASE_URL that may exist in an .env file.
Deno.env.set('DATABASE_URL', 'sqlite://:memory:');
kysely = new Kysely<DittoTables>({
dialect: new DenoSqlite3Dialect({
@ -104,7 +107,6 @@ export const createTestDB = async (databaseUrl?: string) => {
}),
});
} else {
//kysely = await DittoDB.getInstance();
kysely = new Kysely({
dialect: {
createAdapter() {