1 | import { fs } from '@platform/fs';
|
2 | import { NeDb } from '@platform/fsdb.nedb';
|
3 | export { fs };
|
4 | export { expect, expectError } from '@platform/test';
|
5 | export { time } from '@platform/util.value';
|
6 | export * from '../common';
|
7 | let count = 0;
|
8 | const dir = fs.resolve('tmp/test');
|
9 | after(() => fs.remove(dir));
|
10 | export 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 | }
|