RenaiApp/tests/setup/before.ts

22 lines
617 B
TypeScript

import fs from 'fs-extra';
import 'mocha';
import path from 'path';
export const storeDirectory = path.resolve('store');
export const storeBackupDirectory = path.resolve('store-backup');
export const databaseDirectory = path.resolve('database');
export const databaseBackupDirectory = path.resolve('database-backup');
export function moveDir(fromDir: string, toDir: string) {
if (fs.existsSync(fromDir)) {
if (fs.existsSync(toDir)) {
fs.removeSync(toDir);
}
fs.moveSync(fromDir, toDir);
}
}
moveDir(storeDirectory, storeBackupDirectory);
moveDir(databaseDirectory, databaseBackupDirectory);