UNPKG

585 BJavaScriptView Raw
1import { fs } from '@platform/fs';
2import { NeDb } from '@platform/fsdb.nedb';
3export { fs };
4export { expect, expectError } from '@platform/test';
5export { time } from '@platform/util.value';
6export * from '../common';
7let count = 0;
8const dir = fs.resolve('tmp/test');
9after(() => fs.remove(dir));
10export async function getTestDb(options = {}) {
11 let filename;
12 if (options.file) {
13 count++;
14 const file = `test-${count}.db`;
15 await fs.ensureDir(dir);
16 filename = fs.join(dir, file);
17 }
18 const db = NeDb.create({ filename });
19 return db;
20}