Files
BoxBrain/tests/helpers.ts

17 lines
366 B
TypeScript

import { IdentityDB } from 'identitydb';
const openDbs: IdentityDB[] = [];
export async function createDb() {
const db = await IdentityDB.connect({ client: 'sqlite', filename: ':memory:' });
await db.initialize();
openDbs.push(db);
return db;
}
export async function closeOpenDbs() {
while (openDbs.length > 0) {
await openDbs.pop()!.close();
}
}