feat(tests): db test

This commit is contained in:
Alexey Kasyanchuk
2018-02-04 00:31:24 +03:00
parent 28305250aa
commit ae6864ba55
5 changed files with 96 additions and 7 deletions

View File

@ -152,6 +152,28 @@ const writeSphinxConfig = (path) => {
}
`;
// clear dir in test env
if(env.name === 'test')
{
if (fs.existsSync(`${path}/database`)) {
fs.readdirSync(`${path}/database`).forEach(function(file, index){
const curPath = `${path}/database` + "/" + file;
if (!fs.lstatSync(curPath).isDirectory()) {
fs.unlinkSync(curPath);
}
});
fs.readdirSync(path).forEach(function(file, index){
if(!file.startsWith('binlog'))
return;
const curPath = path + "/" + file;
if (!fs.lstatSync(curPath).isDirectory()) {
fs.unlinkSync(curPath);
}
});
}
}
if (!fs.existsSync(`${path}/database`)){
fs.mkdirSync(`${path}/database`);
}

View File

@ -42,10 +42,10 @@ let config = {
const fs = require('fs');
const debug = require('debug')('config')
let configPath = 'config.json'
let configPath = 'rats.json'
if(app && app.getPath("userData") && app.getPath("userData").length > 0)
{
configPath = app.getPath("userData") + '/config.json'
configPath = app.getPath("userData") + '/rats.json'
}
const configProxy = new Proxy(config, {

View File

@ -1,3 +0,0 @@
{
"indexer": true
}